Examples of BCClass


Examples of serp.bytecode.BCClass

                continue;
            }
           
            meth = (Method) fmds[i].getBackingMember();
            // ##### this will fail if we override and don't call super.
            BCClass declaringType = _managedType.getProject()
                .loadClass(fmds[i].getDeclaringType());
            getter = declaringType.getDeclaredMethod(meth.getName(),
                meth.getParameterTypes());
            if (getter == null) {
                addViolation("property-no-getter", new Object[]{ fmds[i] },
                    true);
                continue;
            }
            returned = getReturnedField(getter);
            if (returned != null)
                registerBackingFieldInfo(fmds[i], getter, returned);

            setter = declaringType.getDeclaredMethod(getSetterName(fmds[i]),
                new Class[]{ fmds[i].getDeclaredType() });
            if (setter == null) {
                if (returned == null) {
                    addViolation("property-no-setter",
                        new Object[]{ fmds[i] }, true);
View Full Code Here

Examples of serp.bytecode.BCClass

            for (int i = 0; i < args.length; i++)
                classes.addAll(Arrays.asList(cap.parseTypes(args[i])));
        }

        Project project = new Project();
        BCClass bc;
        PCEnhancer enhancer;
        int status;
        for (Iterator itr = classes.iterator(); itr.hasNext();) {
            Object o = itr.next();
            if (log.isTraceEnabled())
View Full Code Here

Examples of serp.bytecode.BCClass

            ClassLoader l = GeneratedClasses.getMostDerivedLoader(type,
                ProxyBean.class);
            Class pcls = loadBuildTimeProxy(type, l);
            if (pcls == null) {
                // TODO Move this to J2DOPrivHelper?
                BCClass bc = AccessController
                    .doPrivileged(new PrivilegedAction<BCClass>() {
                        public BCClass run() {
                            return generateProxyBeanBytecode(type, true);
                        }
                    });
View Full Code Here

Examples of serp.bytecode.BCClass

     */
    protected BCClass generateProxyCollectionBytecode(Class type,
        boolean runtime) {
        assertNotFinal(type);
        Project project = new Project();
        BCClass bc = AccessController.doPrivileged(J2DoPrivHelper
            .loadProjectClassAction(project, getProxyClassName(type, runtime)));
        bc.setSuperclass(type);
        bc.declareInterface(ProxyCollection.class);
        delegateConstructors(bc, type);
        addProxyMethods(bc, false);
        addProxyCollectionMethods(bc, type);
        proxyRecognizedMethods(bc, type, ProxyCollections.class,
View Full Code Here

Examples of serp.bytecode.BCClass

     * Generate the bytecode for a map proxy for the given type.
     */
    protected BCClass generateProxyMapBytecode(Class type, boolean runtime) {
        assertNotFinal(type);
        Project project = new Project();
        BCClass bc = AccessController.doPrivileged(J2DoPrivHelper
            .loadProjectClassAction(project, getProxyClassName(type, runtime)));
        bc.setSuperclass(type);
        bc.declareInterface(ProxyMap.class);
        delegateConstructors(bc, type);
        addProxyMethods(bc, false);
        addProxyMapMethods(bc, type);
        Class<? extends ProxyMaps> mapProxyClassType =
View Full Code Here

Examples of serp.bytecode.BCClass

     * Generate the bytecode for a date proxy for the given type.
     */
    protected BCClass generateProxyDateBytecode(Class type, boolean runtime) {
        assertNotFinal(type);
        Project project = new Project();
        BCClass bc = AccessController.doPrivileged(J2DoPrivHelper
            .loadProjectClassAction(project, getProxyClassName(type, runtime)));
        bc.setSuperclass(type);
        bc.declareInterface(ProxyDate.class);
        delegateConstructors(bc, type);
        addProxyMethods(bc, true);
        addProxyDateMethods(bc, type);
        proxySetters(bc, type);
View Full Code Here

Examples of serp.bytecode.BCClass

     */
    protected BCClass generateProxyCalendarBytecode(Class type,
        boolean runtime) {
        assertNotFinal(type);
        Project project = new Project();
        BCClass bc = AccessController.doPrivileged(J2DoPrivHelper
            .loadProjectClassAction(project, getProxyClassName(type, runtime)));
        bc.setSuperclass(type);
        bc.declareInterface(ProxyCalendar.class);
        delegateConstructors(bc, type);
        addProxyMethods(bc, true);
        addProxyCalendarMethods(bc, type);
        proxySetters(bc, type);
View Full Code Here

Examples of serp.bytecode.BCClass

            if (cons == null)
                return null;
        }

        Project project = new Project();
        BCClass bc = AccessController.doPrivileged(J2DoPrivHelper
            .loadProjectClassAction(project, getProxyClassName(type, runtime)));
        bc.setSuperclass(type);
        bc.declareInterface(ProxyBean.class);
        delegateConstructors(bc, type);
        addProxyMethods(bc, true);
        addProxyBeanMethods(bc, type, cons);
        if (!proxySetters(bc, type))
View Full Code Here

Examples of serp.bytecode.BCClass

            }));
        }

        final ProxyManagerImpl mgr = new ProxyManagerImpl();
        Class cls;
        BCClass bc;
        for (int i = 0; i < types.size(); i++) {
            cls = Class.forName((String) types.get(i));
            try {
                if (Class.forName(getProxyClassName(cls, false), true,
                    GeneratedClasses.getMostDerivedLoader(cls, Proxy.class))
                    != null)
                    continue;
            } catch (Throwable t) {
                // expected if the class hasn't been generated
            }

            if (Collection.class.isAssignableFrom(cls))
                bc = mgr.generateProxyCollectionBytecode(cls, false);        
            else if (Map.class.isAssignableFrom(cls))
                bc = mgr.generateProxyMapBytecode(cls, false);        
            else if (Date.class.isAssignableFrom(cls))
                bc = mgr.generateProxyDateBytecode(cls, false);
            else if (Calendar.class.isAssignableFrom(cls))
                bc = mgr.generateProxyCalendarBytecode(cls, false);
            else {
                final Class fCls = cls;
                // TODO Move this to J2DOPrivHelper
                bc = AccessController
                    .doPrivileged(new PrivilegedAction<BCClass>() {
                        public BCClass run() {
                            return mgr.generateProxyBeanBytecode(fCls, false);
                        }
                    });
            }

            System.out.println(bc.getName());
            bc.write(new File(dir, bc.getClassName() + ".class"));
        }
    }
View Full Code Here

Examples of serp.bytecode.BCClass

            return Class.forName(name, false, loader);
        } catch (Throwable t) {
        }

        // create class
        BCClass oid = bc.getProject().loadClass(name, null);
        oid.addDefaultConstructor();
        return Class.forName(name, false, bc);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.