Package serp.bytecode

Examples of serp.bytecode.Code.anew()


        Class oidType = _meta.getObjectIdType();
        if (obj && usesClsString == null) {
            // throw new IllegalArgumentException (...);
            String msg = _loc.get("str-cons", oidType,
                _meta.getDescribedType()).getMessage();
            code.anew().setType(IllegalArgumentException.class);
            code.dup();
            code.constant().setValue(msg);
            code.invokespecial().setMethod(IllegalArgumentException.class,
                "<init>", void.class, new Class[]{ String.class });
            code.athrow();
View Full Code Here


            return;
        }

        if (!_meta.isOpenJPAIdentity() && _meta.isObjectIdTypeShared()) {
            // new ObjectId (cls, oid)
            code.anew().setType(ObjectId.class);
            code.dup();
            if(_meta.isEmbeddedOnly() || _meta.hasAbstractPKField() == true) {
                code.aload().setThis();
                code.invokevirtual().setMethod(PRE + "GetIDOwningClass",
                    Class.class, null);
View Full Code Here

                code.classconstant().setClass(getType(_meta));
            }
        }

        // new <oid class> ();
        code.anew().setType(oidType);
        code.dup();
        if (_meta.isOpenJPAIdentity() || (obj && usesClsString ==
                    Boolean.TRUE)) {
            if(_meta.isEmbeddedOnly() || _meta.hasAbstractPKField() == true ) {
                code.aload().setThis();
View Full Code Here

            code.constant().setNull();

        if (_pc.isAbstract())
            code.constant().setNull();
        else {
            code.anew().setType(_pc);
            code.dup();
            code.invokespecial().setMethod("<init>", void.class, null);
        }

        code.invokestatic().setMethod(HELPERTYPE, "register", void.class,
View Full Code Here

        BCMethod method = _pc.declareMethod("writeReplace", Object.class, null);
        method.getExceptions(true).addException(ObjectStreamException.class);
        Code code = method.getCode(true);

        // Object o = new <managed-type>()
        code.anew().setType(_managedType); // for return
        code.dup(); // for post-<init> work
        code.dup(); // for <init>
        code.invokespecial().setMethod(_managedType.getType(), "<init>",
            void.class, null);
View Full Code Here

                    code.iadd();
                } else
                    loadManagedInstance(code, false);

                if (unwrapped != type) {
                    code.anew().setType(type);
                    code.dup();
                }
                code.aload().setLocal(id);
                if (_meta.isOpenJPAIdentity()) {
                    if (oidType == ObjectId.class) {
View Full Code Here

            code.calculateMaxLocals();
            return;
        }

        // XXX pc = new XXX ();
        code.anew().setType(_pc);
        code.dup();
        code.invokespecial().setMethod("<init>", void.class, null);
        int inst = code.getNextLocalsIndex();
        code.astore().setLocal(inst);
View Full Code Here

            code.constant().setNull(); // return null;
        else {
            // return <versionField>;
            Class wrapper = toPrimitiveWrapper(versionField);
            if (wrapper != versionField.getDeclaredType()) {
                code.anew().setType(wrapper);
                code.dup();
            }
            loadManagedInstance(code, false);
            addGetManagedValueCode(code, versionField);
            if (wrapper != versionField.getDeclaredType())
View Full Code Here

        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();
        if (params.length == 1) {
            code.aload().setParam(0);
            code.checkcast().setType(params[0]);
View Full Code Here

        // 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);
            code.checkcast().setType(params[0]);
        }
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.