Examples of FieldMetaData


Examples of org.milyn.flatfile.FieldMetaData

                    String value = fieldValues.get(fieldValueIndex);

                    if (recordMetaData.isWildCardRecord() || i > fieldsMetaData.size() - 1) {
                        field = new Field("field_" + i, value);
                    } else {
                        FieldMetaData fieldMetaData = fieldsMetaData.get(i);

                        if (fieldMetaData.ignore()) {
                            i += fieldMetaData.getIgnoreCount() - 1;
                            if (i < 0) {
                                // An overflow has resulted...
                                i = Integer.MAX_VALUE - 1;
                            }
                            continue;
                        }

                        StringFunctionExecutor stringFunction = fieldMetaData.getStringFunctionExecutor();
                        if (stringFunction != null) {
                            value = stringFunction.execute(value);
                        }

                        field = new Field(fieldMetaData.getName(), value);
                        field.setMetaData(fieldMetaData);
                    }

                    fields.add(field);
                }
View Full Code Here

Examples of org.modeshape.sequencer.javafile.metadata.FieldMetadata

                    }

                    // fields of the class top level type
                    FieldDeclaration[] fieldDeclarations = typeDeclaration.getFields();
                    for (FieldDeclaration fieldDeclaration : fieldDeclarations) {
                        FieldMetadata fieldMetadata = getFieldMetadataFrom(fieldDeclaration);
                        classMetadata.getFields().add(fieldMetadata);
                    }
                    // methods of the class top level type
                    MethodDeclaration[] methodDeclarations = typeDeclaration.getMethods();
                    for (MethodDeclaration methodDeclaration : methodDeclarations) {
                        MethodMetadata methodMetadata = getMethodMetadataFrom(methodDeclaration);
                        classMetadata.getMethods().add(methodMetadata);
                    }
                    metadata.add(classMetadata);
                }
            }

            // process EnumDeclaration
            if (abstractTypeDeclaration instanceof EnumDeclaration) {
                EnumDeclaration enumDeclaration = (EnumDeclaration)abstractTypeDeclaration;

                // is a class top level type
                EnumMetadata enumMetadata = TypeMetadata.enumType(JavaMetadataUtil.getName(enumDeclaration.getName()));
                processModifiersOfTypeDeclaration(enumDeclaration, enumMetadata);

                // Store the enum values
                List<EnumConstantDeclaration> enumValues = enumDeclaration.enumConstants();
                for (EnumConstantDeclaration enumValue : enumValues) {
                    enumMetadata.getValues().add(enumValue.getName().getIdentifier());
                }

                // Enums don't have superclasses

                // detect the interfaces, if any
                for (Type superInterfaceType : (List<Type>)enumDeclaration.superInterfaceTypes()) {
                    enumMetadata.getInterfaceNames().add(getTypeName(superInterfaceType));
                }

                /*
                 * It would be nice to be able to reuse the convenience methods from AbstractTypeDeclaration,
                 * but they don't exist in EnumDeclaration.  So we improvise!
                 */

                List<BodyDeclaration> bodyDecls = enumDeclaration.bodyDeclarations();
                for (BodyDeclaration bodyDecl : bodyDecls) {
                    if (bodyDecl instanceof FieldDeclaration) {
                        // fields of the class top level type
                        FieldMetadata fieldMetadata = getFieldMetadataFrom((FieldDeclaration)bodyDecl);
                        enumMetadata.getFields().add(fieldMetadata);
                    } else if (bodyDecl instanceof MethodDeclaration) {
                        // methods of the class top level type
                        MethodMetadata methodMetadata = getMethodMetadataFrom((MethodDeclaration)bodyDecl);
                        enumMetadata.getMethods().add(methodMetadata);
View Full Code Here

Examples of org.springframework.binding.form.FieldMetadata

      builder.add("title");
      builder.row();
      ConfigurableFormModel formModel = getFormModel();
      ValueModel derivedValueModel = new MessageFormatValueModel("{2} {1} {0}", new ValueModel[] {
          getValueModel("name"), getValueModel("surname"), getValueModel("title") });
      FieldMetadata fieldMetaData = new ReadOnlyFieldMetadata(getFormModel(), String.class);
      formModel.add("derivedValue", derivedValueModel, fieldMetaData);
      builder.add("derivedValue");
      return builder.getForm();
    }
View Full Code Here

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

     * @param identifier can be <code>null</code>
     * @return the identifier (never returns null)
     */
    private FieldMetadata getIdentifierField() {
        if (parent != null) {
            final FieldMetadata idField = parent.getIdentifierField();
            if (idField != null) {
                if (MemberFindingUtils.getAnnotationOfType(
                        idField.getAnnotations(), ID) != null) {
                    return idField;
                }
                else if (MemberFindingUtils.getAnnotationOfType(
                        idField.getAnnotations(), EMBEDDED_ID) != null) {
                    return idField;
                }
            }
            return parent.getIdentifierField();
        }

        // Try to locate an existing field with @javax.persistence.Id
        final List<FieldMetadata> idFields = governorTypeDetails
                .getFieldsWithAnnotation(ID);
        if (!idFields.isEmpty()) {
            return getIdentifierField(idFields, ID);
        }

        // Try to locate an existing field with @javax.persistence.EmbeddedId
        final List<FieldMetadata> embeddedIdFields = governorTypeDetails
                .getFieldsWithAnnotation(EMBEDDED_ID);
        if (!embeddedIdFields.isEmpty()) {
            return getIdentifierField(embeddedIdFields, EMBEDDED_ID);
        }

        // Ensure there isn't already a field called "id"; if so, compute a
        // unique name (it's not really a fatal situation at the end of the day)
        final JavaSymbolName idField = governorTypeDetails
                .getUniqueFieldName(getIdentifierFieldName());

        // We need to create one
        final JavaType identifierType = getIdentifierType();

        final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>();
        final boolean hasIdClass = !(identifierType.isCoreType() || identifierType
                .equals(GAE_DATASTORE_KEY));
        final JavaType annotationType = hasIdClass ? EMBEDDED_ID : ID;
        annotations.add(new AnnotationMetadataBuilder(annotationType));

        // Encode keys as strings on GAE to support entity group hierarchies
        if (isGaeEnabled && identifierType.equals(JavaType.STRING)) {
            AnnotationMetadataBuilder extensionBuilder = new AnnotationMetadataBuilder(
                    DATANUCLEUS_JPA_EXTENSION);
            extensionBuilder.addStringAttribute("vendorName", "datanucleus");
            extensionBuilder.addStringAttribute("key", "gae.encoded-pk");
            extensionBuilder.addStringAttribute("value", "true");
            annotations.add(extensionBuilder);
        }

        // Compute the column name, as required
        if (!hasIdClass) {
            if (!"".equals(annotationValues.getSequenceName())) {
                String generationType = isGaeEnabled || isDatabaseDotComEnabled ? "IDENTITY"
                        : "AUTO";

                // ROO-746: Use @GeneratedValue(strategy = GenerationType.TABLE)
                // If the root of the governor declares @Inheritance(strategy =
                // InheritanceType.TABLE_PER_CLASS)
                if ("AUTO".equals(generationType)) {
                    AnnotationMetadata inheritance = governorTypeDetails
                            .getAnnotation(INHERITANCE);
                    if (inheritance == null) {
                        inheritance = getInheritanceAnnotation();
                    }
                    if (inheritance != null) {
                        final AnnotationAttributeValue<?> value = inheritance
                                .getAttribute(new JavaSymbolName("strategy"));
                        if (value instanceof EnumAttributeValue) {
                            final EnumAttributeValue enumAttributeValue = (EnumAttributeValue) value;
                            final EnumDetails details = enumAttributeValue
                                    .getValue();
                            if (details != null
                                    && details.getType().equals(
                                            INHERITANCE_TYPE)) {
                                if ("TABLE_PER_CLASS".equals(details.getField()
                                        .getSymbolName())) {
                                    generationType = "TABLE";
                                }
                            }
                        }
                    }
                }

                final AnnotationMetadataBuilder generatedValueBuilder = new AnnotationMetadataBuilder(
                        GENERATED_VALUE);
                generatedValueBuilder.addEnumAttribute("strategy",
                        new EnumDetails(GENERATION_TYPE, new JavaSymbolName(
                                generationType)));

                if (StringUtils.isNotBlank(annotationValues.getSequenceName())
                        && !(isGaeEnabled || isDatabaseDotComEnabled)) {
                    final String sequenceKey = StringUtils
                            .uncapitalize(destination.getSimpleTypeName())
                            + "Gen";
                    generatedValueBuilder.addStringAttribute("generator",
                            sequenceKey);
                    final AnnotationMetadataBuilder sequenceGeneratorBuilder = new AnnotationMetadataBuilder(
                            SEQUENCE_GENERATOR);
                    sequenceGeneratorBuilder.addStringAttribute("name",
                            sequenceKey);
                    sequenceGeneratorBuilder.addStringAttribute("sequenceName",
                            annotationValues.getSequenceName());
                    annotations.add(sequenceGeneratorBuilder);
                }
                annotations.add(generatedValueBuilder);
            }

            final String identifierColumn = StringUtils
                    .stripToEmpty(getIdentifierColumn());
            String columnName = idField.getSymbolName();
            if (StringUtils.isNotBlank(identifierColumn)) {
                // User has specified an alternate column name
                columnName = identifierColumn;
            }

View Full Code Here

Examples of org.terasology.reflection.metadata.FieldMetadata

        for (NetData.SerializationInfo info : infoList) {
            ClassMetadata<? extends T, ?> metadata = classLibrary.getMetadata(new SimpleUri(info.getName()));
            if (metadata != null) {
                idTable.put(metadata.getType(), info.getId());
                for (int i = 0; i < info.getFieldIds().size(); ++i) {
                    FieldMetadata field = metadata.getField(info.getFieldName(i));
                    if (field != null) {
                        field.setId(info.getFieldIds().byteAt(i));
                    } else {
                        logger.error("Server has unknown field '{}' on '{}'", info.getFieldName(i), info.getName());
                    }
                }
            } else {
View Full Code Here

Examples of play.utils.meta.FieldMetadata

    return models.get(modelType);
  }

  private FieldMetadata toFieldMetadata(Field field) {
    Converter<?> converter = converters.getConverter(field.getType());
    return new FieldMetadata(field, converter);
  }
View Full Code Here

Examples of xgenerator.model.FieldMetadata

   * </p>
   * @author <a href="mailto:shushanlee@msn.com">liss</a>
   * @param rowIndex
   */
  private void insertRowEditable(int rowIndex) {
    FieldMetadata fieldMetadata = buildNewRowData();
    this.cellEditableVector.insertElementAt(mapRowEditableVector(fieldMetadata), rowIndex);
  }
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.