当前位置: 首页>>代码示例>>Java>>正文


Java FieldMetadata类代码示例

本文整理汇总了Java中org.springframework.roo.classpath.details.FieldMetadata的典型用法代码示例。如果您正苦于以下问题:Java FieldMetadata类的具体用法?Java FieldMetadata怎么用?Java FieldMetadata使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FieldMetadata类属于org.springframework.roo.classpath.details包,在下文中一共展示了FieldMetadata类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getListInner_getter

import org.springframework.roo.classpath.details.FieldMetadata; //导入依赖的package包/类
/**
 * Generate a getter for <code>field</code>
 * 
 * @param field field metadata
 * @return
 */
private MethodMetadataBuilder getListInner_getter(FieldMetadata field) {
    // Gets filed name
    String fieldName = field.getFieldName().getSymbolName();

    // Generate method body
    InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
    bodyBuilder.appendFormalLine(MessageFormat.format("return {0};",
            new Object[] { fieldName }));

    // Creates Method builder
    MethodMetadataBuilder builder = new MethodMetadataBuilder(getId(),
            Modifier.PUBLIC, new JavaSymbolName("get".concat(StringUtils
                    .capitalize(fieldName))), field.getFieldType(),
            bodyBuilder);

    return builder;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:24,代码来源:EntityBatchMetadata.java

示例2: getListInner_setter

import org.springframework.roo.classpath.details.FieldMetadata; //导入依赖的package包/类
/**
 * Generate a setter for <code>field</code>
 * 
 * @param field field metadata
 * @return
 */
private MethodMetadataBuilder getListInner_setter(FieldMetadata field) {
    // Gets filed name
    String fieldName = field.getFieldName().getSymbolName();

    // prepares method body
    InvocableMemberBodyBuilder bodyBuilder = new InvocableMemberBodyBuilder();
    bodyBuilder.appendFormalLine(MessageFormat.format("this.{0} = {0};",
            new Object[] { fieldName }));

    // Create method builder
    MethodMetadataBuilder builder = new MethodMetadataBuilder(getId(),
            Modifier.PUBLIC, new JavaSymbolName("set".concat(StringUtils
                    .capitalize(fieldName))), JavaType.VOID_PRIMITIVE,
            bodyBuilder);

    // Adds setter parameter
    List<AnnotationMetadata> annotations = new ArrayList<AnnotationMetadata>();
    builder.addParameterType(new AnnotatedJavaType(field.getFieldType(),
            annotations));
    builder.addParameterName(field.getFieldName());

    return builder;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:30,代码来源:EntityBatchMetadata.java

示例3: addTestMasterRegister

import org.springframework.roo.classpath.details.FieldMetadata; //导入依赖的package包/类
/**
 * Add Selenium commands for master register pattern test.
 * 
 * @param entity Entity to test
 * @param document Document to write commands
 * @param element Element where store commands
 * @param baseURL Server and application URL path
 * @param name Pattern name
 */
protected void addTestMasterRegister(JavaType entity, Document document,
        Element element, String baseURL, String name, String id) {

    List<FieldMetadata> fields = webMetadataService
            .getScaffoldEligibleFieldMetadata(entity,
                    getMemberDetails(entity), null);

    // Open register pattern URL
    element.appendChild(openCommandRegister(document, baseURL, name));

    // Add register
    addTestRegisterAdd(entity, document, element, fields, id);

    // Update link access and submit opened form
    element.appendChild(clickAndWaitCommand(document, "//a[@id='ps_"
            + XmlUtils.convertId(entity.getFullyQualifiedTypeName())
            + "_update'" + "]"));
    element.appendChild(clickAndWaitCommand(document, INPUT_AT_PROC));

    // Update register fields verification
    addVerificationRegister(entity, document, element, fields);

    addTestRegisterDelete(entity, document, element);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:34,代码来源:SeleniumServicesImpl.java

示例4: addTestTabularEditRegister

import org.springframework.roo.classpath.details.FieldMetadata; //导入依赖的package包/类
/**
 * Add Selenium commands for master tabular with register edit pattern test.
 * 
 * @param entity Entity to test
 * @param document Document to write commands
 * @param element Element where store commands
 * @param baseURL Server and application URL path
 * @param name Pattern name
 */
protected void addTestTabularEditRegister(JavaType entity,
        Document document, Element element, String baseURL, String name,
        String id) {

    List<FieldMetadata> fields = webMetadataService
            .getScaffoldEligibleFieldMetadata(entity,
                    getMemberDetails(entity), null);

    // Add register
    addTestTabularEditRegisterAdd(entity, document, element, fields, id);

    // Update check table first row
    element.appendChild(checkCommand(document, entity));

    // Update link access
    element.appendChild(clickAndWaitCommand(document, "//img[@id='fu_"
            + XmlUtils.convertId(entity.getFullyQualifiedTypeName())
            + "_update'" + "]"));
    element.appendChild(clickAndWaitCommand(document, INPUT_AT_PROC));

    addTestTabularDelete(entity, document, element);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:32,代码来源:SeleniumServicesImpl.java

示例5: getEntityFieldNameJavaType

import org.springframework.roo.classpath.details.FieldMetadata; //导入依赖的package包/类
/**
 * Get java type for field.
 * 
 * @param fieldName Field name of entity
 * @param entity Entity
 * @return Java type of field in entity
 */
protected JavaType getEntityFieldNameJavaType(JavaSymbolName fieldName,
        JavaType entity) {

    JavaType fieldType = null;
    MemberDetails memberDetails = getMemberDetails(entity);
    Iterator<FieldMetadata> fieldsMetadata = webMetadataService
            .getScaffoldEligibleFieldMetadata(entity, memberDetails, null)
            .iterator();
    while (fieldsMetadata.hasNext() && fieldType == null) {
        FieldMetadata fieldMetadata = fieldsMetadata.next();
        if (fieldMetadata.getFieldName().equals(fieldName)) {
            fieldType = fieldMetadata.getFieldType();
        }
    }

    return fieldType;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:25,代码来源:SeleniumServicesImpl.java

示例6: getUserField

import org.springframework.roo.classpath.details.FieldMetadata; //导入依赖的package包/类
private FieldMetadata getUserField() {
    if (userField == null) {
        List<AnnotationMetadataBuilder> annotations = null;
        if (context.getUserTypeIsEntity()) {
            annotations = new ArrayList<AnnotationMetadataBuilder>(1);
            annotations.add(new AnnotationMetadataBuilder(
                    AnnotationMetadataBuilder.JPA_MANY_TO_ONE_ANNOTATION));

        }
        userField = helper
                .getField(
                        USER_FIELD,
                        Modifier.PRIVATE,
                        context.getUserType(),
                        annotations,
                        GET_FIELD_EXISTS_ACTION.RETURN_EXISTING_IF_ANNOTATION_MATCH);
    }
    return userField;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:20,代码来源:EnversRevisionLogEntityMetadataBuilder.java

示例7: getFieldEntityPlural

import org.springframework.roo.classpath.details.FieldMetadata; //导入依赖的package包/类
/**
 * Given a FieldMetadata it returns the pluralized name of its Class in
 * plural.
 * <p>
 * If the FieldMetadata type is a Collection will return the plural of the
 * parameter in the Collection definition. That is:<br/>
 * <code>java.util.Set&lt;Foo&gt;</code> will return <code>Foos</code>
 * 
 * @param fieldMetadata
 * @return
 */
private String getFieldEntityPlural(FieldMetadata fieldMetadata) {
    JavaType fieldEntity = fieldMetadata.getFieldType();
    if (fieldEntity.isCommonCollectionType()
            && !fieldEntity.getParameters().isEmpty()) {
        fieldEntity = fieldEntity.getParameters().get(0);
    }
    ClassOrInterfaceTypeDetails cid = getTypeLocationService()
            .getTypeDetails(fieldEntity);
    JavaType javaType = cid.getName();
    LogicalPath path = PhysicalTypeIdentifier.getPath(cid
            .getDeclaredByMetadataId());

    PluralMetadata pluralMetadata = (PluralMetadata) getMetadataService()
            .get(PluralMetadata.createIdentifier(javaType, path));

    return pluralMetadata.getPlural().toLowerCase();
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:29,代码来源:AbstractPatternJspMetadataListener.java

示例8: getIdField

import org.springframework.roo.classpath.details.FieldMetadata; //导入依赖的package包/类
/**
 * @param helper
 * @return
 */
private FieldMetadata getIdField() {
    if (idField == null) {
        List<AnnotationMetadataBuilder> annotations = helper
                .toAnnotationMetadata(JpaJavaType.ID,
                        JpaJavaType.GENERATED_VALUE, REVISION_NUMBER);
        idField = helper
                .getField(
                        ID_FIELD,
                        Modifier.PRIVATE,
                        JavaType.LONG_OBJECT,
                        annotations,
                        GET_FIELD_EXISTS_ACTION.RETURN_EXISTING_IF_ANNOTATION_MATCH);
    }
    return idField;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:20,代码来源:EnversRevisionLogEntityMetadataBuilder.java

示例9: getFieldTypeOfFinder

import org.springframework.roo.classpath.details.FieldMetadata; //导入依赖的package包/类
public JavaType getFieldTypeOfFinder(String fieldName) {
    String paramName;
    for (FieldMetadata field : finderMethod.getFinderMethodParamFields()) {
        paramName = field.getFieldName().getSymbolName();
        if (paramName.equalsIgnoreCase(fieldName)) {
            return field.getFieldType();
        }
        else if (paramName.startsWith("min") || paramName.startsWith("max")) {
            // for params used on between comparations
            if (paramName.substring(3).equalsIgnoreCase(fieldName)) {
                return field.getFieldType();
            }
        }
    }
    return null;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:17,代码来源:FinderToDslHelper.java

示例10: EqualsMetadata

import org.springframework.roo.classpath.details.FieldMetadata; //导入依赖的package包/类
/**
 * Constructor
 * 
 * @param identifier the ID of this piece of metadata (required)
 * @param aspectName the name of the ITD to generate (required)
 * @param governorPhysicalTypeMetadata the details of the governor
 *            (required)
 * @param annotationValues the values of the @RooEquals annotation
 *            (required)
 * @param equalityFields the fields to be compared by the
 *            <code>equals</code> method (can be <code>null</code> or empty)
 */
public EqualsMetadata(final String identifier, final JavaType aspectName,
        final PhysicalTypeMetadata governorPhysicalTypeMetadata,
        final EqualsAnnotationValues annotationValues,
        final List<FieldMetadata> equalityFields) {
    super(identifier, aspectName, governorPhysicalTypeMetadata);
    Validate.isTrue(isValid(identifier), "Metadata id '%s' is invalid",
            identifier);
    Validate.notNull(annotationValues, "Annotation values required");

    this.annotationValues = annotationValues;
    locatedFields = equalityFields;

    if (!CollectionUtils.isEmpty(equalityFields)) {
        builder.addMethod(getEqualsMethod());
        builder.addMethod(getHashCodeMethod());
    }

    // Create a representation of the desired output ITD
    itdTypeDetails = builder.build();
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:33,代码来源:EqualsMetadata.java

示例11: getInvokedField

import org.springframework.roo.classpath.details.FieldMetadata; //导入依赖的package包/类
/**
 * Returns the field on which this method is invoked
 * 
 * @return <code>null</code> if it's a static method call
 * @throws IllegalStateException if there's more than one field in the
 *             builder
 */
public FieldMetadata getInvokedField() {
    if (classOrInterfaceDetailsBuilder == null) {
        return null;
    }
    final List<FieldMetadataBuilder> declaredFields = classOrInterfaceDetailsBuilder
            .getDeclaredFields();
    switch (declaredFields.size()) {
    case 0:
        return null;
    case 1:
        return declaredFields.get(0).build();
    default:
        throw new IllegalStateException("Multiple fields introduced for "
                + this);
    }
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:24,代码来源:MemberTypeAdditions.java

示例12: addDataToField

import org.springframework.roo.classpath.details.FieldMetadata; //导入依赖的package包/类
public void addDataToField(final FieldMetadata replacement,
        final CustomData customData) {
    // If the MIDs don't match then the proposed can't be a replacement
    if (!replacement.getDeclaredByMetadataId().equals(
            getDeclaredByMetadataId())) {
        return;
    }
    for (final FieldMetadataBuilder existingField : getDeclaredFields()) {
        if (existingField.getFieldName().equals(
                replacement.getFieldName())) {
            for (final Object key : customData.keySet()) {
                existingField.putCustomData(key, customData.get(key));
            }
            break;
        }
    }
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:18,代码来源:MemberDetailsBuilder.java

示例13: toActionScriptType

import org.springframework.roo.classpath.details.FieldMetadata; //导入依赖的package包/类
public static ActionScriptType toActionScriptType(FieldMetadata javaField) {
    ActionScriptType asType = toActionScriptType(javaField.getFieldType());
    if (asType.isNumeric()) {
        boolean isVersion = false;

        for (AnnotationMetadata annotation : javaField.getAnnotations()) {
            if (annotation.getAnnotationType().getFullyQualifiedTypeName()
                    .equals("javax.persistence.Version")) {
                isVersion = true;
            }
        }

        if (isVersion) {
            return ActionScriptType.NUMBER_TYPE;
        }
    }
    return asType;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:19,代码来源:ActionScriptMappingUtils.java

示例14: buildListViewDocument

import org.springframework.roo.classpath.details.FieldMetadata; //导入依赖的package包/类
private Document buildListViewDocument(
        FlexScaffoldMetadata flexScaffoldMetadata,
        List<FieldMetadata> elegibleFields) {
    ActionScriptType entityType = ActionScriptMappingUtils
            .toActionScriptType(flexScaffoldMetadata.getEntity());
    StringTemplate listViewTemplate = this.templateGroup
            .getInstanceOf("org/gvnix/flex/roo/addon/ui/entity_list_view");
    listViewTemplate.setAttribute("entityType", entityType);
    listViewTemplate.setAttribute("flexScaffoldMetadata",
            flexScaffoldMetadata);
    listViewTemplate.setAttribute("fields", elegibleFields);

    try {
        ByteArrayInputStream stream = new ByteArrayInputStream(
                listViewTemplate.toString().getBytes("UTF-8"));
        return XmlUtils.getDocumentBuilder().parse(stream);
    }
    catch (Exception e) {
        throw new IllegalStateException(
                "Failed to build list view document", e);
    }
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:23,代码来源:FlexUIMetadataProvider.java

示例15: getEntityToManyField

import org.springframework.roo.classpath.details.FieldMetadata; //导入依赖的package包/类
/** {@inheritDoc} */
public FieldMetadata getEntityToManyField(JavaType entity, String fieldName) {

    List<FieldMetadata> toManyFields = getEntityToManyFields(entity);
    for (FieldMetadata toManyField : toManyFields) {
        if (toManyField.getFieldName().getSymbolName().equals(fieldName)) {
            return toManyField;
        }
    }

    return null;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:13,代码来源:PatternServicesImpl.java


注:本文中的org.springframework.roo.classpath.details.FieldMetadata类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。