Examples of InvocableMemberBodyBuilder


Examples of org.springframework.roo.classpath.itd.InvocableMemberBodyBuilder

        builder.getImportRegistrationResolver().addImport(EQUALS_BUILDER);

        final String typeName = destination.getSimpleTypeName();

        // Create the method
        final InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
        bodyBuilder.appendFormalLine("if (!(" + OBJECT_NAME + " instanceof "
                + typeName + ")) {");
        bodyBuilder.indent();
        bodyBuilder.appendFormalLine("return false;");
        bodyBuilder.indentRemove();
        bodyBuilder.appendFormalLine("}");
        bodyBuilder.appendFormalLine("if (this == " + OBJECT_NAME + ") {");
        bodyBuilder.indent();
        bodyBuilder.appendFormalLine("return true;");
        bodyBuilder.indentRemove();
        bodyBuilder.appendFormalLine("}");
        bodyBuilder.appendFormalLine(typeName + " rhs = (" + typeName + ") "
                + OBJECT_NAME + ";");

        final StringBuilder builder = new StringBuilder(
                "return new EqualsBuilder()");
        if (annotationValues.isAppendSuper()) {
            builder.append(".appendSuper(super.equals(" + OBJECT_NAME + "))");
        }
        for (final FieldMetadata field : locatedFields) {
            builder.append(".append(" + field.getFieldName() + ", rhs."
                    + field.getFieldName() + ")");
        }
        builder.append(".isEquals();");

        bodyBuilder.appendFormalLine(builder.toString());

        return new MethodMetadataBuilder(getId(), Modifier.PUBLIC,
                EQUALS_METHOD_NAME, BOOLEAN_PRIMITIVE,
                AnnotatedJavaType.convertFromJavaTypes(parameterType),
                parameterNames, bodyBuilder);
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.