Package org.springframework.roo.classpath.details

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


            }

            annotations.add(columnBuilder);
        }

        return new FieldMetadataBuilder(getId(), Modifier.PRIVATE, annotations,
                idField, identifierType).build();
    }
View Full Code Here


            final JavaType identifierType) {
        Validate.isTrue(identifierFields.size() == 1,
                "More than one field was annotated with @%s in '%s'",
                identifierType.getSimpleTypeName(),
                destination.getFullyQualifiedTypeName());
        return new FieldMetadataBuilder(identifierFields.get(0)).build();
    }
View Full Code Here

        final AnnotationMetadataBuilder columnBuilder = new AnnotationMetadataBuilder(
                COLUMN);
        columnBuilder.addStringAttribute("name", versionColumn);
        annotations.add(columnBuilder);

        return new FieldMetadataBuilder(getId(), Modifier.PRIVATE, annotations,
                verField, versionType).build();
    }
View Full Code Here

            }
        }
    }

    public FieldMetadata build() {
        final FieldMetadataBuilder fieldMetadataBuilder = new FieldMetadataBuilder(
                declaredByMetadataId);
        fieldMetadataBuilder.setAnnotations(annotations);
        fieldMetadataBuilder.setFieldInitializer(fieldInitializer);
        fieldMetadataBuilder.setFieldName(fieldName);
        fieldMetadataBuilder.setFieldType(fieldType);
        fieldMetadataBuilder.setModifier(modifier);
        return fieldMetadataBuilder.build();
    }
View Full Code Here

                    helperType.getFullyQualifiedTypeName());
        }
        else {
            // Add the field via the ITD
            final String initializer = "new LocalServiceTestHelper(new com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig())";
            final FieldMetadataBuilder fieldBuilder = new FieldMetadataBuilder(
                    getId(), Modifier.PRIVATE | Modifier.STATIC
                            | Modifier.FINAL, new JavaSymbolName("helper"),
                    helperType, initializer);
            builder.addField(fieldBuilder);
        }
View Full Code Here

        }
        else {
            // Add the field via the ITD
            final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
            annotations.add(new AnnotationMetadataBuilder(AUTOWIRED));
            final FieldMetadataBuilder fieldBuilder = new FieldMetadataBuilder(
                    getId(), 0, annotations, new JavaSymbolName("dod"),
                    dodGovernor);
            builder.addField(fieldBuilder);
        }
View Full Code Here

        if (governorTypeDetails.getField(fieldName) != null) {
            return null;
        }

        addToImports(Arrays.asList(fieldType));
        return new FieldMetadataBuilder(getId(), modifier, fieldName,
                fieldType, fieldInitializer);
    }
View Full Code Here

                if (identifier.getFieldType().equals(DATE)) {
                    setDateAnnotations(identifier.getColumnDefinition(),
                            annotations);
                }

                final FieldMetadata idField = new FieldMetadataBuilder(getId(),
                        Modifier.PRIVATE, annotations,
                        identifier.getFieldName(), identifier.getFieldType())
                        .build();

                // Only add field to ITD if not declared on governor
                if (!hasField(declaredFields, idField)) {
                    fields.add(idField);
                }
            }
        }

        fields.addAll(declaredFields);

        // Remove fields with static and transient modifiers
        for (final Iterator<FieldMetadata> iter = fields.iterator(); iter
                .hasNext();) {
            final FieldMetadata field = iter.next();
            if (Modifier.isStatic(field.getModifier())
                    || Modifier.isTransient(field.getModifier())) {
                iter.remove();
            }
        }

        // Remove fields with the @Transient annotation
        final List<FieldMetadata> transientAnnotatedFields = governorTypeDetails
                .getFieldsWithAnnotation(TRANSIENT);
        if (fields.containsAll(transientAnnotatedFields)) {
            fields.removeAll(transientAnnotatedFields);
        }

        final List<FieldMetadataBuilder> fieldBuilders = new ArrayList<FieldMetadataBuilder>();
        if (!fields.isEmpty()) {
            for (final FieldMetadata field : fields) {
                fieldBuilders.add(new FieldMetadataBuilder(field));
            }
            return fieldBuilders;
        }

        // We need to create a default identifier field
        final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();

        // Compute the column name, as required
        final AnnotationMetadataBuilder columnBuilder = new AnnotationMetadataBuilder(
                COLUMN);
        columnBuilder.addStringAttribute("name", "id");
        columnBuilder.addBooleanAttribute("nullable", false);
        annotations.add(columnBuilder);

        fieldBuilders.add(new FieldMetadataBuilder(getId(), Modifier.PRIVATE,
                annotations, new JavaSymbolName("id"), LONG_OBJECT));

        return fieldBuilders;
    }
View Full Code Here

        }
    }

    @Override
    public FieldMetadata build() {
        final FieldMetadataBuilder fieldMetadataBuilder = new FieldMetadataBuilder(
                declaredByMetadataId);
        fieldMetadataBuilder.setAnnotations(annotations);
        fieldMetadataBuilder.setFieldInitializer(fieldInitializer);
        fieldMetadataBuilder.setFieldName(fieldName);
        fieldMetadataBuilder.setFieldType(fieldType);
        fieldMetadataBuilder.setModifier(modifier);
        return fieldMetadataBuilder.build();
    }
View Full Code Here

        for (final FieldMetadata field : persistenceMemberLocator
                .getEmbeddedIdentifierFields(formBackingType)) {
            final JavaType fieldType = field.getFieldType();
            if (!fieldType.isCommonCollectionType()
                    && !isSpecialType(fieldType)) {
                final FieldMetadataBuilder fieldBuilder = new FieldMetadataBuilder(
                        field);
                final String fieldName = field.getFieldName().getSymbolName();
                fieldBuilder.setFieldName(new JavaSymbolName(fieldName + "."
                        + fieldName));
                tbody.appendChild(typeCommand(document, fieldBuilder.build()));
            }
        }

        // Add all other fields
        final List<FieldMetadata> fields = webMetadataService
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.