本文整理汇总了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() + "()";
}
示例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();
}
示例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;
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}