本文整理汇总了Java中org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails.getTypeAnnotation方法的典型用法代码示例。如果您正苦于以下问题:Java ClassOrInterfaceTypeDetails.getTypeAnnotation方法的具体用法?Java ClassOrInterfaceTypeDetails.getTypeAnnotation怎么用?Java ClassOrInterfaceTypeDetails.getTypeAnnotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails
的用法示例。
在下文中一共展示了ClassOrInterfaceTypeDetails.getTypeAnnotation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getManagedIdentifiers
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
private Set<ClassOrInterfaceTypeDetails> getManagedIdentifiers() {
final Set<ClassOrInterfaceTypeDetails> managedIdentifierTypes = new LinkedHashSet<ClassOrInterfaceTypeDetails>();
final Set<ClassOrInterfaceTypeDetails> identifierTypes = typeLocationService
.findClassesOrInterfaceDetailsWithAnnotation(ROO_IDENTIFIER);
for (final ClassOrInterfaceTypeDetails managedIdentifierType : identifierTypes) {
final AnnotationMetadata identifierAnnotation = managedIdentifierType
.getTypeAnnotation(ROO_IDENTIFIER);
final AnnotationAttributeValue<?> attrValue = identifierAnnotation
.getAttribute(DB_MANAGED);
if (attrValue != null && (Boolean) attrValue.getValue()) {
managedIdentifierTypes.add(managedIdentifierType);
}
}
return managedIdentifierTypes;
}
示例2: addEqualsAndHashCodeMethods
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
public void addEqualsAndHashCodeMethods(final JavaType javaType,
final boolean appendSuper, final Set<String> excludeFields) {
// Add @RooEquals annotation to class if not yet present
final ClassOrInterfaceTypeDetails cid = typeLocationService
.getTypeDetails(javaType);
if (cid == null || cid.getTypeAnnotation(ROO_EQUALS) != null) {
return;
}
final AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(
ROO_EQUALS);
if (appendSuper) {
annotationBuilder.addBooleanAttribute("appendSuper", appendSuper);
}
if (!CollectionUtils.isEmpty(excludeFields)) {
final List<StringAttributeValue> attributes = new ArrayList<StringAttributeValue>();
for (final String excludeField : excludeFields) {
attributes.add(new StringAttributeValue(new JavaSymbolName(
"value"), excludeField));
}
annotationBuilder
.addAttribute(new ArrayAttributeValue<StringAttributeValue>(
new JavaSymbolName("excludeFields"), attributes));
}
final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
cid);
cidBuilder.addAnnotation(annotationBuilder.build());
typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());
}
示例3: addSolrSearchableAnnotation
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
private void addSolrSearchableAnnotation(
final ClassOrInterfaceTypeDetails cid) {
if (cid.getTypeAnnotation(ROO_SOLR_SEARCHABLE) == null) {
final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
cid);
cidBuilder.addAnnotation(new AnnotationMetadataBuilder(
ROO_SOLR_SEARCHABLE));
typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build());
}
}
示例4: getMetadata
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
@Override
protected ItdTypeDetailsProvidingMetadataItem getMetadata(String id,
JavaType aspectName, PhysicalTypeMetadata physicalType,
String itdFilename) {
// Install web service (dependencies, properties, plugins and config)
getWSConfigService().install(WsType.EXPORT);
// We know governor type details are non-null and can be safely cast
// Check if Web Service definition is correct
// TODO What is this for ?
PhysicalTypeDetails physicalTypeDetails = physicalType
.getMemberHoldingTypeDetails();
if (physicalTypeDetails == null
|| !(physicalTypeDetails instanceof ClassOrInterfaceTypeDetails)) {
// There is a problem
return null;
}
// We have reliable physical type details
ClassOrInterfaceTypeDetails typeDetails = (ClassOrInterfaceTypeDetails) physicalTypeDetails;
// Work out the MIDs of the other metadata we depend on
String physicalTypeId = PhysicalTypeIdentifier.createIdentifier(
WSExportXmlElementMetadata.getJavaType(id),
WSExportXmlElementMetadata.getPath(id));
// We need to be informed if our dependent metadata changes
// TODO What is this for ?
getMetadataDependencyRegistry().registerDependency(physicalTypeId, id);
AnnotationMetadata annotation = typeDetails
.getTypeAnnotation(new JavaType(GvNIXXmlElement.class.getName()));
// Create metaData with field list values.
return new WSExportXmlElementMetadata(id, aspectName, physicalType,
getDeclaredFields(typeDetails, annotation),
getJavaParserService());
}
示例5: getWebServiceDefaultNamespace
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public String getWebServiceDefaultNamespace(JavaType javaType) {
// Get and validate mutable type details
ClassOrInterfaceTypeDetails typeDetails = typeLocationService
.getTypeDetails(javaType);
Validate.isInstanceOf(ClassOrInterfaceTypeDetails.class, typeDetails,
"Can't modify ".concat(typeDetails.getName().toString()));
// Get and validate gvNIX web service annotation
AnnotationMetadata annotation = typeDetails
.getTypeAnnotation(new JavaType(GvNIXWebService.class.getName()));
Validate.isTrue(
annotation != null,
"Launch command 'service define ws --class ".concat(
javaType.getFullyQualifiedTypeName()).concat(
"' to export class to Web Service."));
// Get and validate gvNIX web service annotation target namespace attr
StringAttributeValue targetNamespace = (StringAttributeValue) annotation
.getAttribute(new JavaSymbolName("targetNamespace"));
Validate.notNull(
targetNamespace,
"You must define 'targetNamespace' annotation attribute in @GvNIXWebService in class: '"
.concat(javaType.getFullyQualifiedTypeName()).concat(
"'."));
Validate.isTrue(
StringUtils.isNotBlank(targetNamespace.getValue()),
"You must define 'targetNamespace' annotation attribute in @GvNIXWebService in class: '"
.concat(javaType.getFullyQualifiedTypeName()).concat(
"'."));
// Get and validate gvNIX web service annotation target namespace value
String targetNamespaceValue = targetNamespace.getValue();
Validate.isTrue(
checkNamespaceFormat(targetNamespaceValue),
"Attribute 'targetNamespace' in @GvNIXWebService for Web Service class '"
.concat(javaType.getFullyQualifiedTypeName())
.concat("'has to start with 'http://'.\ni.e.: http://name.of.namespace/"));
return targetNamespaceValue;
}