Package serp.bytecode

Examples of serp.bytecode.BCMethod.makePublic()


     */
    private void addProxyBeanMethods(BCClass bc, Class type, Constructor cons) {
        // bean copy
        BCMethod m = bc.declareMethod("copy", Object.class,
            new Class[] { Object.class });
        m.makePublic();
        Code code = m.getCode(true);

        code.anew().setType(type);
        code.dup();
        Class[] params = cons.getParameterTypes();
View Full Code Here


        code.calculateMaxLocals();

        // new instance factory
        m = bc.declareMethod("newInstance", ProxyBean.class,
            new Class[] { Object.class });
        m.makePublic();
        code = m.getCode(true);
        code.anew().setType(bc);
        code.dup();
        if (params.length == 1) {
            code.aload().setParam(0);
View Full Code Here

     */
    private void proxyOverrideMethod(BCClass bc, Method meth,
        Method helper, Class[] params) {
        BCMethod m = bc.declareMethod(meth.getName(), meth.getReturnType(),
            meth.getParameterTypes());
        m.makePublic();
        Code code = m.getCode(true);

        code.aload().setThis();
        for (int i = 1; i < params.length; i++)
            code.xload().setParam(i - 1).setType(params[i]);
View Full Code Here

     */
    private void proxyBeforeAfterMethod(BCClass bc, Class type, Method meth,
        Method before, Class[] params, Method after, Class[] afterParams) {
        BCMethod m = bc.declareMethod(meth.getName(), meth.getReturnType(),
            meth.getParameterTypes());
        m.makePublic();
        Code code = m.getCode(true);

        // invoke before
        int beforeRet = -1;
        if (before != null) {
View Full Code Here

     */
    private void proxySetter(BCClass bc, Class type, Method meth) {
        Class[] params = meth.getParameterTypes();
        Class ret = meth.getReturnType();
        BCMethod m = bc.declareMethod(meth.getName(), ret, params);
        m.makePublic();
        Code code = m.getCode(true);
        code.aload().setThis();
        code.constant().setValue(true);
        code.invokestatic().setMethod(Proxies.class, "dirty", void.class,
            new Class[] { Proxy.class, boolean.class });
View Full Code Here

        BCField type = bc.declareField("type", Class.class);
        type.setStatic(true);
        type.makePrivate();
        // public Class getType() {
        BCMethod getter = bc.declareMethod("getType", Class.class, null);
        getter.makePublic();
        Code code = getter.getCode(true);
        // if (type == null) {
        //     try {
        //       type = Class.forName
        //         (meta.getDescribedType().getName(), true,
View Full Code Here

        BCMethod m;
        Code code;
        for (int i = 0; i < cons.length; i++) {
            params = cons[i].getParameterTypes();
            m = bc.declareMethod("<init>", void.class, params);
            m.makePublic();

            code = m.getCode(true);
            code.aload().setThis();
            for (int j = 0; j < params.length; j++)
                code.xload().setParam(j).setType(params[j]);
View Full Code Here

        BCField field = bc.declareField("field", int.class);
        field.setTransient(true);

        BCMethod m = bc.declareMethod("setOwner", void.class, new Class[] {
            OpenJPAStateManager.class, int.class });
        m.makePublic();
        Code code = m.getCode(true);
        code.aload().setThis();
        code.aload().setParam(0);
        code.putfield().setField(sm);
        code.aload().setThis();
View Full Code Here

        code.vreturn();
        code.calculateMaxStack();
        code.calculateMaxLocals();

        m = bc.declareMethod("getOwner", OpenJPAStateManager.class, null);
        m.makePublic();
        code = m.getCode(true);
        code.aload().setThis();
        code.getfield().setField(sm);
        code.areturn();
        code.calculateMaxStack();
View Full Code Here

        code.areturn();
        code.calculateMaxStack();
        code.calculateMaxLocals();

        m = bc.declareMethod("getOwnerField", int.class, null);
        m.makePublic();
        code = m.getCode(true);
        code.aload().setThis();
        code.getfield().setField(field);
        code.ireturn();
        code.calculateMaxStack();
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.