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


Java FieldMetadata.getAnnotation方法代码示例

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


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

示例1: getFieldInitializerForRelatedEntity

import org.springframework.roo.classpath.details.FieldMetadata; //导入方法依赖的package包/类
private String getFieldInitializerForRelatedEntity(
        final FieldMetadata field,
        final DataOnDemandMetadata collaboratingMetadata,
        final Set<?> fieldCustomDataKeys) {
    // To avoid circular references, we don't try to set nullable fields
    final boolean nullableField = field.getAnnotation(NOT_NULL) == null
            && isNullableJoinColumn(field);
    if (nullableField) {
        return null;
    }
    final String collaboratingFieldName = getCollaboratingFieldName(
            field.getFieldType()).getSymbolName();
    if (fieldCustomDataKeys.contains(CustomDataKeys.ONE_TO_ONE_FIELD)) {
        // We try to keep the same ID (ROO-568)
        return collaboratingFieldName
                + "."
                + collaboratingMetadata.getSpecificPersistentEntityMethod()
                        .getMethodName().getSymbolName() + "(" + INDEX_VAR
                + ")";
    }
    return collaboratingFieldName
            + "."
            + collaboratingMetadata.getRandomPersistentEntityMethod()
                    .getMethodName().getSymbolName() + "()";
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:26,代码来源:DataOnDemandMetadata.java

示例2: isNullableJoinColumn

import org.springframework.roo.classpath.details.FieldMetadata; //导入方法依赖的package包/类
private boolean isNullableJoinColumn(final FieldMetadata field) {
    final AnnotationMetadata joinColumnAnnotation = field
            .getAnnotation(JOIN_COLUMN);
    if (joinColumnAnnotation == null) {
        return true;
    }
    final AnnotationAttributeValue<?> nullableAttr = joinColumnAnnotation
            .getAttribute(new JavaSymbolName("nullable"));
    return nullableAttr == null || (Boolean) nullableAttr.getValue();
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:11,代码来源:DataOnDemandMetadata.java

示例3: isUIComponent

import org.springframework.roo.classpath.details.FieldMetadata; //导入方法依赖的package包/类
private boolean isUIComponent(FieldMetadata field, JavaType fieldType,
        CustomData customData) {

    if (field.getAnnotation(ROO_UPLOADED_FILE) != null
            || fieldType.equals(BOOLEAN_OBJECT)
            || fieldType.equals(BOOLEAN_PRIMITIVE)
            || customData.keySet().contains(ENUMERATED_KEY)
            || JdkJavaType.isDateField(fieldType)
            || JdkJavaType.isIntegerType(fieldType)
            || JdkJavaType.isDecimalType(fieldType)
            || fieldType.equals(STRING)) {

        return true;

    }
    else if (customData.keySet().contains(PARAMETER_TYPE_KEY)) {
        if (StringUtils.isNotBlank((String) customData
                .get(PARAMETER_TYPE_MANAGED_BEAN_NAME_KEY))) {
            if (customData.keySet().contains(ONE_TO_MANY_FIELD)
                    || customData.keySet().contains(MANY_TO_MANY_FIELD)
                    && isInverseSideOfRelationship(field, ONE_TO_MANY,
                            MANY_TO_MANY)) {
                return false;
            }
        }

        return true;

    }
    else if (customData.keySet().contains(APPLICATION_TYPE_KEY)) {
        if (customData.keySet().contains(ONE_TO_ONE_FIELD)
                && isInverseSideOfRelationship(field, ONE_TO_ONE)) {
            return false;
        }
        return true;
    }
    else {
        return true;
    }
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:41,代码来源:JsfManagedBeanMetadata.java

示例4: hasFieldAllAnnotation

import org.springframework.roo.classpath.details.FieldMetadata; //导入方法依赖的package包/类
/**
 * Check if a currentField has all annotations
 * <p/>
 * TODO check annotation values
 * 
 * @param currentField
 * @param annotationsRequired
 * @return
 */
private boolean hasFieldAllAnnotation(FieldMetadata currentField,
        List<AnnotationMetadataBuilder> annotationsRequired) {

    for (AnnotationMetadataBuilder annotation : annotationsRequired) {
        if (currentField.getAnnotation(annotation.getAnnotationType()) == null) {
            return false;
        }
    }

    return true;
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:21,代码来源:ItdBuilderHelper.java

示例5: isConversionServiceField

import org.springframework.roo.classpath.details.FieldMetadata; //导入方法依赖的package包/类
private boolean isConversionServiceField(FieldMetadata field) {
    return field != null && field.getAnnotation(AUTOWIRED) != null
            && field.getFieldType().equals(CONVERSION_SERVICE);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:5,代码来源:DatatablesMetadata.java

示例6: isEntityManagerProviderField

import org.springframework.roo.classpath.details.FieldMetadata; //导入方法依赖的package包/类
private boolean isEntityManagerProviderField(FieldMetadata field) {
    return field != null
            && field.getAnnotation(AUTOWIRED) != null
            && field.getFieldName()
                    .equals(DATATABLES_MANAGER_PROVIDER_NAME);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:7,代码来源:DatatablesMetadata.java

示例7: isMessageSourceField

import org.springframework.roo.classpath.details.FieldMetadata; //导入方法依赖的package包/类
private boolean isMessageSourceField(FieldMetadata field) {
    return field != null && field.getAnnotation(AUTOWIRED) != null
            && field.getFieldType().equals(MESSAGE_SOURCE);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:5,代码来源:DatatablesMetadata.java

示例8: isDatatablesUtilsBean

import org.springframework.roo.classpath.details.FieldMetadata; //导入方法依赖的package包/类
private boolean isDatatablesUtilsBean(FieldMetadata field) {
    return field != null && field.getAnnotation(AUTOWIRED) != null
            && field.getFieldType().equals(DATATABLES_UTILS_BEAN);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:5,代码来源:DatatablesMetadata.java

示例9: isQuerydslUtilsBean

import org.springframework.roo.classpath.details.FieldMetadata; //导入方法依赖的package包/类
private boolean isQuerydslUtilsBean(FieldMetadata field) {
    return field != null && field.getAnnotation(AUTOWIRED) != null
            && field.getFieldType().equals(QUERYDSL_UTILS_BEAN);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:5,代码来源:DatatablesMetadata.java

示例10: getMetadata

import org.springframework.roo.classpath.details.FieldMetadata; //导入方法依赖的package包/类
/**
 * Return an instance of the Metadata offered by this add-on
 */
protected ItdTypeDetailsProvidingMetadataItem getMetadata(
        String metadataIdentificationString, JavaType aspectName,
        PhysicalTypeMetadata governorPhysicalTypeMetadata,
        String itdFilename) {

    JavaType javaType = GvNIXEntityMapLayerMetadata
            .getJavaType(metadataIdentificationString);

    // Getting entity details
    ClassOrInterfaceTypeDetails entityDetails = getTypeLocationService()
            .getTypeDetails(javaType);

    LogicalPath entityPath = PhysicalTypeUtils.getPath(javaType,
            getTypeLocationService());

    String jpaMetadataId = JpaActiveRecordMetadata.createIdentifier(
            javaType, entityPath);
    JpaActiveRecordMetadata jpaMetadata = (JpaActiveRecordMetadata) getMetadataService()
            .get(jpaMetadataId);
    if (jpaMetadata == null) {
        // Unsupported type (by now)
        return null;
    }

    GvNIXEntityMapLayerValues annotationValues = new GvNIXEntityMapLayerValues(
            entityDetails);

    // Getting entity plural
    String plural = jpaMetadata.getPlural();

    // Getting declared fields
    // List<JavaSymbolName> geoFieldNames = new ArrayList<JavaSymbolName>();
    Map<JavaSymbolName, AnnotationAttributeValue<Integer>> geoFields = new HashMap<JavaSymbolName, AnnotationAttributeValue<Integer>>();
    List<? extends FieldMetadata> fields = entityDetails
            .getDeclaredFields();
    for (FieldMetadata field : fields) {
        // Getting field type to get package
        JavaType fieldType = field.getFieldType();
        JavaPackage fieldPackage = fieldType.getPackage();
        // If has jts field, annotate entity
        if (fieldPackage.toString().equals("com.vividsolutions.jts.geom")) {
            AnnotationMetadata srsAnnotation = field
                    .getAnnotation(new JavaType(
                            "org.gvnix.jpa.geo.hibernatespatial.util.SRS"));
            AnnotationAttributeValue<Integer> srsAnnotationValue = null;
            if (srsAnnotation != null) {
                srsAnnotationValue = srsAnnotation.getAttribute("value");
            }
            geoFields.put(field.getFieldName(), srsAnnotationValue);
        }
    }

    return new GvNIXEntityMapLayerMetadata(metadataIdentificationString,
            aspectName, governorPhysicalTypeMetadata,
            getTypeLocationService(), getTypeManagementService(), javaType,
            plural, geoFields, annotationValues);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:61,代码来源:GvNIXEntityMapLayerMetadataProvider.java

示例11: JpaQueryMetadata

import org.springframework.roo.classpath.details.FieldMetadata; //导入方法依赖的package包/类
public JpaQueryMetadata(String identifier, JavaType aspectName,
        PhysicalTypeMetadata governorPhysicalTypeMetadata) {
    super(identifier, aspectName, governorPhysicalTypeMetadata);
    Validate.isTrue(isValid(identifier), "Metadata identification string '"
            + identifier + "' does not appear to be a valid");

    this.helper = new ItdBuilderHelper(this, governorPhysicalTypeMetadata,
            builder.getImportRegistrationResolver());

    // Prepare fields Map ordered by name
    Map<FieldMetadata, AnnotationMetadata> fieldsToProcess = newFieldsMap();

    // Locate field with @GvNIXJpaFilterProperty
    AnnotationMetadata annotation;
    for (FieldMetadata field : governorTypeDetails.getDeclaredFields()) {
        annotation = field.getAnnotation(GVNIX_JPA_QUERY);
        if (annotation != null) {
            fieldsToProcess.put(field, annotation);
        }
    }

    // No fields to process
    if (fieldsToProcess.isEmpty()) {
        return;
    }

    // Adding static field to store filterBy definition
    builder.addField(getFilterByField());

    // Adding method to get FilterBy
    builder.addMethod(getFilterByMethod(fieldsToProcess));

    // Adding static field to store orderBy definition
    builder.addField(getOrderByField());

    // Adding method to get FilterBy
    builder.addMethod(getOrderByMethod(fieldsToProcess));

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

示例12: isConversionServiceField

import org.springframework.roo.classpath.details.FieldMetadata; //导入方法依赖的package包/类
/**
 * Check if filed is a valid conversion service
 * 
 * @param field
 * @return
 */
private boolean isConversionServiceField(FieldMetadata field) {
    return field != null && field.getAnnotation(AUTOWIRED) != null
            && field.getFieldType().equals(CONVERSION_SERVICE);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:11,代码来源:WebJpaBatchMetadata.java


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