Package org.springframework.roo.classpath.details

Examples of org.springframework.roo.classpath.details.FieldMetadataBuilder


  }

  private FieldMetadataBuilder getMultipleEntityIdField(
      final JavaSymbolName fieldName) {
    builder.getImportRegistrationResolver().addImport(HASH_SET);
    return new FieldMetadataBuilder(getId(), Modifier.PRIVATE, fieldName,
        new JavaType(SET.getFullyQualifiedTypeName(), 0, DataType.TYPE,
            null, Collections.singletonList(GAE_DATASTORE_KEY)),
        "new HashSet<Key>()");
  }
View Full Code Here


    return bodyBuilder;
  }

  private FieldMetadataBuilder getSingularEntityIdField(
      final JavaSymbolName fieldName) {
    return new FieldMetadataBuilder(getId(), Modifier.PRIVATE, fieldName,
        LONG_OBJECT, null);
  }
View Full Code Here

                callerMID);
        final AnnotationMetadataBuilder autowiredAnnotation = new AnnotationMetadataBuilder(
                AUTOWIRED);
        final String repositoryFieldName = StringUtils
                .uncapitalize(repositoryType.getSimpleTypeName());
        cidBuilder.addField(new FieldMetadataBuilder(callerMID, 0, Arrays
                .asList(autowiredAnnotation), new JavaSymbolName(
                repositoryFieldName), repositoryType));

        // Create the additions to invoke the given method on this field
        final String methodCall = repositoryFieldName + "."
View Full Code Here

        if (!idFields.isEmpty()) {
            return idFields.get(0);
        }
        final JavaSymbolName idFieldName = governorTypeDetails
                .getUniqueFieldName("id");
        final FieldMetadataBuilder fieldBuilder = new FieldMetadataBuilder(
                getId(), Modifier.PRIVATE, idFieldName, idType, null);
        fieldBuilder.addAnnotation(new AnnotationMetadataBuilder(
                SpringJavaType.DATA_ID));
        return fieldBuilder.build();
    }
View Full Code Here

        final List<JavaType> parameters = Arrays.asList(OBJECT, destination);
        final JavaType function = new JavaType("org.op4j.functions.Function",
                0, DataType.TYPE, null, parameters);
        final int fieldModifier = Modifier.PUBLIC | Modifier.STATIC
                | Modifier.FINAL;
        final FieldMetadataBuilder fieldBuilder = new FieldMetadataBuilder(
                getId(), fieldModifier, new JavaSymbolName(
                        targetName.toUpperCase()), function, initializer);
        fields.add(fieldBuilder);

        final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
View Full Code Here

            final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
                    declaredByMetadataId, Modifier.PUBLIC, name,
                    PhysicalTypeCategory.CLASS);

            // Create instance of entity to test
            final FieldMetadataBuilder fieldBuilder = new FieldMetadataBuilder(
                    declaredByMetadataId);
            fieldBuilder.setModifier(Modifier.PRIVATE);
            fieldBuilder.setFieldName(new JavaSymbolName(StringUtils
                    .uncapitalize(javaType.getSimpleTypeName())));
            fieldBuilder.setFieldType(javaType);
            fieldBuilder.setFieldInitializer("new "
                    + javaType.getFullyQualifiedTypeName() + "()");
            final List<FieldMetadataBuilder> fields = new ArrayList<FieldMetadataBuilder>();
            fields.add(fieldBuilder);
            cidBuilder.setDeclaredFields(fields);
View Full Code Here

                callerMID);
        final AnnotationMetadataBuilder autowiredAnnotation = new AnnotationMetadataBuilder(
                AUTOWIRED);
        final String repositoryFieldName = StringUtils
                .uncapitalize(repositoryType.getSimpleTypeName());
        cidBuilder.addField(new FieldMetadataBuilder(callerMID, 0, Arrays
                .asList(autowiredAnnotation), new JavaSymbolName(
                repositoryFieldName), repositoryType));

        // Create the additions to invoke the given method on this field
        final String methodCall = repositoryFieldName + "."
View Full Code Here

        final String fieldName = StringUtils.uncapitalize(serviceInterface
                .getSimpleTypeName());

        if (autowire) {
            // Add an autowired field of the type of this service
            cidBuilder.addField(new FieldMetadataBuilder(callerMID, 0, Arrays
                    .asList(new AnnotationMetadataBuilder(AUTOWIRED)),
                    new JavaSymbolName(fieldName), serviceInterface));
        }
        else {
            // Add a set method of the type of this service
            cidBuilder.addField(new FieldMetadataBuilder(callerMID, 0,
                    new JavaSymbolName(fieldName), serviceInterface, null));
            JavaSymbolName setMethodName = new JavaSymbolName("set"
                    + serviceInterface.getSimpleTypeName());
            List<JavaType> parameterTypes = new ArrayList<JavaType>();
            parameterTypes.add(serviceInterface);
View Full Code Here

        final ClassOrInterfaceTypeDetails simpleInterfaceDetails = typeParsingService
                .getTypeFromString(fileContents, SIMPLE_CLASS_DECLARED_BY_MID,
                        SIMPLE_CLASS_TYPE);

        final FieldMetadataBuilder fieldBuilder = new FieldMetadataBuilder(
                SIMPLE_CLASS_DECLARED_BY_MID, Modifier.PRIVATE,
                new JavaSymbolName("newFieldAddedByCode"), new JavaType(
                        String.class), "\"Create by code\"");
        final ClassOrInterfaceTypeDetails newSimpleInterfaceDetails = addField(
                simpleInterfaceDetails, fieldBuilder.build());

        // Invoke
        final String result = typeParsingService
                .updateAndGetCompilationUnitContents(file.getCanonicalPath(),
                        newSimpleInterfaceDetails);
View Full Code Here

        fieldDetails.setModifiers(modifier);

        // Format the passed-in comment (if given)
        formatFieldComment(fieldDetails);

        final FieldMetadataBuilder fieldBuilder = new FieldMetadataBuilder(
                fieldDetails);
        fieldBuilder.setFieldInitializer(initializer);
        typeManagementService.addField(fieldBuilder.build());
    }
View Full Code Here

TOP

Related Classes of org.springframework.roo.classpath.details.FieldMetadataBuilder

Copyright © 2018 www.massapicom. 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.