Package org.cojen.classfile

Examples of org.cojen.classfile.CodeBuilder.invoke()


            if (bp.getType().isPrimitive()) {
                continue;
            }

            b.loadLocal(beanVar);
            b.invoke(bp.getReadMethod());

            Label noMatch = b.createLabel();
            b.ifNullBranch(noMatch, false);
            b.loadConstant(true);
            b.returnValue(TypeDesc.BOOLEAN);
View Full Code Here


                    continue;
                }

                b.loadLocal(valueVar);
                b.loadLocal(beanVar);
                b.invoke(bp.getReadMethod());
                b.convert(TypeDesc.forClass(bp.getType()), TypeDesc.OBJECT);
                b.invokeVirtual(Object.class.getName(), "equals", TypeDesc.BOOLEAN, params);

                Label noMatch = b.createLabel();
                b.ifZeroComparisonBranch(noMatch, "==");
View Full Code Here

                    }
                   
                    switch (methodType) {
                    case READ_METHOD: case TRY_READ_METHOD: default: {
                        b.loadLocal(beanVar);
                        b.invoke(bp.getReadMethod());
                        TypeDesc type = TypeDesc.forClass(bp.getType());
                        b.convert(type, type.toObjectType());
                        b.returnValue(TypeDesc.OBJECT);
                        break;
                    }
View Full Code Here

                        b.loadLocal(beanVar);
                        b.loadLocal(valueVar);
                        TypeDesc type = TypeDesc.forClass(bp.getType());
                        b.checkCast(type.toObjectType());
                        b.convert(type.toObjectType(), type);
                        b.invoke(bp.getWriteMethod());
                        if (methodType == WRITE_METHOD) {
                            b.returnVoid();
                        } else {
                            b.loadConstant(true);
                            b.returnValue(TypeDesc.BOOLEAN);
View Full Code Here

            b.dup();
            int count = b.getParameterCount();
            for (int i=0; i<count; i++) {
                b.loadLocal(b.getParameter(i));
            }
            b.invoke(ctor);
            b.returnValue(TypeDesc.OBJECT);
        }

        if (cf == null) {
            // No methods found to implement.
View Full Code Here

            builder.loadField("mUsingComparators", comparatorArrayType);
            builder.loadConstant(0);
            builder.loadFromArray(TypeDesc.forClass(Comparator.class));
            builder.loadLocal(obj1);
            builder.loadLocal(obj2);
            builder.invoke(compareMethod);
            builder.storeLocal(result);
            builder.loadLocal(result);
            label = builder.createLabel();
            builder.ifZeroComparisonBranch(label, "==");
            builder.loadLocal(result);
View Full Code Here

            LocalVariable p1 = builder.createLocalVariable("p1", propertyType);
            LocalVariable p2 = builder.createLocalVariable("p2", propertyType);

            // Access properties and store in local variables.
            builder.loadLocal(obj1);
            builder.invoke(prop.getReadMethod());
            builder.storeLocal(p1);
            builder.loadLocal(obj2);
            builder.invoke(prop.getReadMethod());
            builder.storeLocal(p2);
View Full Code Here

            // Access properties and store in local variables.
            builder.loadLocal(obj1);
            builder.invoke(prop.getReadMethod());
            builder.storeLocal(p1);
            builder.loadLocal(obj2);
            builder.invoke(prop.getReadMethod());
            builder.storeLocal(p2);

            if ((bc.mFlags & 0x01) != 0) {
                // Reverse properties.
                LocalVariable temp = p1;
View Full Code Here

                builder.loadFromArray(TypeDesc.forClass(Comparator.class));
                builder.loadLocal(p1);
                builder.convert(propertyType, propertyType.toObjectType());
                builder.loadLocal(p2);
                builder.convert(propertyType, propertyType.toObjectType());
                builder.invoke(compareMethod);
            } else {
                // If case-sensitive is off and a collator is provided and
                // property could be a String, apply collator.
                if ((bc.mFlags & 0x04) == 0 && bc.mCollator != null &&
                    propertyClass.isAssignableFrom(String.class)) {
View Full Code Here

                    builder.loadField("mCollators", comparatorArrayType);
                    builder.loadConstant(i);
                    builder.loadFromArray(TypeDesc.forClass(Comparator.class));
                    builder.loadLocal(p1);
                    builder.loadLocal(p2);
                    builder.invoke(compareMethod);

                    resultLabel.setLocation();
                } else if (propertyClass.isPrimitive()) {
                    generatePrimitiveComparison(builder, propertyClass, p1,p2);
                } else {
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.