本文整理汇总了Java中org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails类的典型用法代码示例。如果您正苦于以下问题:Java ClassOrInterfaceTypeDetails类的具体用法?Java ClassOrInterfaceTypeDetails怎么用?Java ClassOrInterfaceTypeDetails使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClassOrInterfaceTypeDetails类属于org.springframework.roo.classpath.details包,在下文中一共展示了ClassOrInterfaceTypeDetails类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAnnotationValueStringAttributes
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入依赖的package包/类
/**
* Get string attributes of a annotation from a type details.
*
* @param typeDetails Type details
* @param annotation Annotation java type
* @return Type details annotation string attributes
*/
protected List<StringAttributeValue> getAnnotationValueStringAttributes(
ClassOrInterfaceTypeDetails typeDetails, JavaType annotation) {
List<StringAttributeValue> patternAttributes = new ArrayList<StringAttributeValue>();
AnnotationMetadata patternAnnotation = MemberFindingUtils
.getAnnotationOfType(typeDetails.getAnnotations(), annotation);
if (patternAnnotation != null) {
// look for pattern name in @GvNIXPattern values
AnnotationAttributeValue<?> patternValues = patternAnnotation
.getAttribute("value");
if (patternValues != null) {
@SuppressWarnings("unchecked")
List<StringAttributeValue> patternValue = (List<StringAttributeValue>) patternValues
.getValue();
patternAttributes.addAll(patternValue);
}
}
return patternAttributes;
}
示例2: getSuffix
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入依赖的package包/类
private String getSuffix(
final List<MemberHoldingTypeDetails> memberHoldingTypeDetailsList,
final boolean singular, final Map<String, String> pluralMap) {
final ClassOrInterfaceTypeDetails cid = getMostConcreteClassOrInterfaceTypeDetails(memberHoldingTypeDetailsList);
if (singular) {
return cid.getName().getSimpleTypeName();
}
String plural = pluralMap.get(cid.getDeclaredByMetadataId());
for (final AnnotationMetadata annotationMetadata : cid.getAnnotations()) {
if (annotationMetadata.getAnnotationType()
.getFullyQualifiedTypeName()
.equals(ROO_PLURAL.getFullyQualifiedTypeName())) {
final AnnotationAttributeValue<?> annotationAttributeValue = annotationMetadata
.getAttribute(new JavaSymbolName("value"));
if (annotationAttributeValue != null) {
plural = annotationAttributeValue.getValue().toString();
}
break;
}
}
if (StringUtils.isNotBlank(plural)) {
plural = StringUtils.capitalize(plural);
}
return plural;
}
示例3: AbstractAnnotationValues
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入依赖的package包/类
protected AbstractAnnotationValues(
final MemberHoldingTypeDetails memberHoldingTypeDetails,
final JavaType annotationType) {
Validate.notNull(annotationType, "Annotation to locate is required");
if (memberHoldingTypeDetails instanceof ClassOrInterfaceTypeDetails) {
classParsed = true;
// We have reliable physical type details
governorTypeDetails = (ClassOrInterfaceTypeDetails) memberHoldingTypeDetails;
// Process values from the annotation, if present
annotationMetadata = governorTypeDetails
.getAnnotation(annotationType);
}
}
示例4: getDestinationPackage
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入依赖的package包/类
private JavaPackage getDestinationPackage(final Database database,
final Set<ClassOrInterfaceTypeDetails> managedEntities) {
JavaPackage destinationPackage = database.getDestinationPackage();
if (destinationPackage == null) {
if (!managedEntities.isEmpty() && !database.hasMultipleSchemas()) {
// Take the package of the first one
destinationPackage = managedEntities.iterator().next()
.getName().getPackage();
}
}
// Fall back to project's top level package
if (destinationPackage == null) {
destinationPackage = projectOperations.getFocusedTopLevelPackage();
}
return destinationPackage;
}
示例5: isActiveRecord
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入依赖的package包/类
/**
* Indicates whether active record CRUD methods should be generated for the
* given entities (this being an all or nothing decision)
*
* @param database the database being reverse-engineered (required)
* @param managedEntities any existing DB-managed entities in the user
* project (can be <code>null</code> or empty)
* @return see above
*/
private boolean isActiveRecord(final Database database,
final Collection<ClassOrInterfaceTypeDetails> managedEntities) {
if (CollectionUtils.isEmpty(managedEntities)) {
// There are no existing entities; use the given setting
return database.isActiveRecord();
}
/*
* There are one or more existing entities; preserve the existing
* decision, based on the first such entity. This saves the user from
* having to enter the same value for the "activeRecord" option each
* time they run the database reverse engineer command.
*/
return managedEntities.iterator().next()
.getAnnotation(ROO_JPA_ACTIVE_RECORD) != null;
}
示例6: testSimpleInterfaceNoChanges
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入依赖的package包/类
@Test
public void testSimpleInterfaceNoChanges() throws Exception {
// Set up
final File file = getResource(SIMPLE_INTERFACE_FILE_PATH);
final String fileContents = getResourceContents(file);
final ClassOrInterfaceTypeDetails simpleInterfaceDetails = typeParsingService
.getTypeFromString(fileContents,
SIMPLE_INTERFACE_DECLARED_BY_MID, SIMPLE_INTERFACE_TYPE);
// Invoke
final String result = typeParsingService
.getCompilationUnitContents(simpleInterfaceDetails);
// Save to file for debug
saveResult(file, result);
checkSimpleInterface(result);
}
示例7: annotateGeoEntityController
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入依赖的package包/类
/**
* This method annotates controller with @GvNIXEntityMapLayer
*
* @param controller
* @param path
*/
public void annotateGeoEntityController(JavaType controller, String path) {
ClassOrInterfaceTypeDetails controllerDetails = getTypeLocationService()
.getTypeDetails(controller);
// Generating annotation
ClassOrInterfaceTypeDetailsBuilder detailsBuilder = new ClassOrInterfaceTypeDetailsBuilder(
controllerDetails);
AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(
GVNIX_WEB_ENTITY_MAP_LAYER_ANNOTATION);
// Add annotation to target type
detailsBuilder.updateTypeAnnotation(annotationBuilder.build());
// Save changes to disk
getTypeManagementService().createOrUpdateTypeOnDisk(
detailsBuilder.build());
}
示例8: findTypeForTableName
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入依赖的package包/类
/**
* Locates the type associated with the presented table name.
*
* @param managedEntities a set of database-managed entities to search
* (required)
* @param tableName the table to locate (required)
* @param schemaName the table's schema name
* @return the type (if known) or null (if not found)
*/
public static JavaType findTypeForTableName(
final Iterable<ClassOrInterfaceTypeDetails> managedEntities,
final String tableName, final String schemaName) {
Validate.notNull(managedEntities, "Set of managed entities required");
Validate.notBlank(tableName, "Table name required");
for (final ClassOrInterfaceTypeDetails managedEntity : managedEntities) {
final String managedSchemaName = getSchemaName(managedEntity);
if (tableName.equals(getTableName(managedEntity))
&& (!DbreModelService.NO_SCHEMA_REQUIRED
.equals(managedSchemaName) || schemaName
.equals(managedSchemaName))) {
return managedEntity.getName();
}
}
return null;
}
示例9: getMemberDetails
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入依赖的package包/类
/**
* Returns details of the given physical type's members
*
* @param physicalTypeMetadata the physical type for which to get the
* members (can be <code>null</code>)
* @return <code>null</code> if the member details are unavailable
*/
protected MemberDetails getMemberDetails(
final PhysicalTypeMetadata physicalTypeMetadata) {
if(memberDetailsScanner == null){
memberDetailsScanner = getMemberDetailsScanner();
}
Validate.notNull(memberDetailsScanner, "MemberDetailsScanner is required");
// We need to abort if we couldn't find dependent metadata
if (physicalTypeMetadata == null || !physicalTypeMetadata.isValid()) {
return null;
}
final ClassOrInterfaceTypeDetails cid = physicalTypeMetadata
.getMemberHoldingTypeDetails();
if (cid == null) {
// Abort if the type's class details aren't available (parse error
// etc)
return null;
}
return memberDetailsScanner.getMemberDetails(getClass().getName(), cid);
}
示例10: getAllMapsControllers
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入依赖的package包/类
/**
*
* This method returns all available maps Controllers
*
* @param typeLocationService
* @return
*/
public static List<JavaType> getAllMapsControllers(
TypeLocationService typeLocationService) {
List<JavaType> controllers = new ArrayList<JavaType>();
for (JavaType mapViewer : typeLocationService
.findTypesWithAnnotation(MAP_VIEWER_ANNOTATION)) {
Validate.notNull(mapViewer, "@GvNIXMapViewer required");
ClassOrInterfaceTypeDetails mapViewerController = typeLocationService
.getTypeDetails(mapViewer);
// Getting RequestMapping annotations
final AnnotationMetadata requestMappingAnnotation = MemberFindingUtils
.getAnnotationOfType(mapViewerController.getAnnotations(),
SpringJavaType.REQUEST_MAPPING);
Validate.notNull(mapViewer, String.format(
"Error on %s getting @RequestMapping value", mapViewer));
controllers.add(mapViewer);
}
return controllers;
}
示例11: annotateType
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入依赖的package包/类
public void annotateType(final JavaType javaType) {
Validate.notNull(javaType, "Java type required");
final ClassOrInterfaceTypeDetails cid = typeLocationService
.getTypeDetails(javaType);
if (cid == null) {
throw new IllegalArgumentException("Cannot locate source for '"
+ javaType.getFullyQualifiedTypeName() + "'");
}
if (MemberFindingUtils.getAnnotationOfType(cid.getAnnotations(),
ROO_OP4J) == null) {
final AnnotationMetadataBuilder annotationBuilder = new AnnotationMetadataBuilder(
ROO_OP4J);
final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
cid);
cidBuilder.addAnnotation(annotationBuilder);
typeManagementService.createOrUpdateTypeOnDisk(cid);
}
}
示例12: getInnerType
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入依赖的package包/类
private ClassOrInterfaceTypeDetails getInnerType() {
final List<FieldMetadataBuilder> fields = new ArrayList<FieldMetadataBuilder>();
builder.getImportRegistrationResolver().addImports(OP4J_GET,
JAVA_RUN_TYPE_TYPES);
final String targetName = super.destination.getSimpleTypeName();
final String initializer = "Get.attrOf(Types.forClass(" + targetName
+ ".class),\"" + targetName.toLowerCase() + "\")";
final List<JavaType> parameters = Arrays.asList(OBJECT, destination);
final JavaType function = new JavaType("org.op4j.functions.Function",
0, DataType.TYPE, null, parameters);
final int fieldModifier = Modifier.PUBLIC | Modifier.STATIC
| Modifier.FINAL;
final FieldMetadataBuilder fieldBuilder = new FieldMetadataBuilder(
getId(), fieldModifier, new JavaSymbolName(
targetName.toUpperCase()), function, initializer);
fields.add(fieldBuilder);
final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(
getId(), Modifier.PUBLIC | Modifier.STATIC, KEYS,
PhysicalTypeCategory.CLASS);
cidBuilder.setDeclaredFields(fields);
return cidBuilder.build();
}
示例13: assertAdditions
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入依赖的package包/类
/**
* Asserts that asking the {@link ServiceLayerProvider} for a method with
* the given name and parameters results in the given method signature
*
* @param plural
* @param mockServiceInterfaces can be empty
* @param methodId
* @param expectedMethodSignature <code>null</code> means no additions are
* expected
* @param methodParameters
*/
private void assertAdditions(final String plural,
final List<ClassOrInterfaceTypeDetails> mockServiceInterfaces,
final String methodId, final String expectedMethodSignature,
final MethodParameter... methodParameters) {
// Set up
setUpPluralMetadata(plural);
when(mockServiceInterfaceLocator.getServiceInterfaces(mockTargetType))
.thenReturn(mockServiceInterfaces);
// Invoke
final MemberTypeAdditions additions = provider.getMemberTypeAdditions(
CALLER_MID, methodId, mockTargetType, mockIdType,
methodParameters);
// Check
if (expectedMethodSignature == null) {
assertNull("Expected no additions but found: " + additions,
additions);
}
else {
assertNotNull("Expected some additions but was null", additions);
assertEquals(expectedMethodSignature, additions.getMethodCall());
}
}
示例14: getMetadata
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入依赖的package包/类
/**
* Return an instance of the Metadata offered by this add-on
*/
@Override
protected ItdTypeDetailsProvidingMetadataItem getMetadata(
String metadataIdentificationString, JavaType aspectName,
PhysicalTypeMetadata governorPhysicalTypeMetadata,
String itdFilename) {
// We know governor type details are non-null and can be safely cast
ClassOrInterfaceTypeDetails controllerDetails = (ClassOrInterfaceTypeDetails) governorPhysicalTypeMetadata
.getMemberHoldingTypeDetails();
Validate.notNull(
controllerDetails,
"Governor failed to provide class type details, in violation of superclass contract");
AnnotationMetadata stringTrimmerAnnotation = MemberFindingUtils
.getAnnotationOfType(controllerDetails.getAnnotations(),
GVNIX_STRING_TRIMMER_BINDER);
boolean emptyAsNull = ((BooleanAttributeValue) stringTrimmerAnnotation
.getAttribute(new JavaSymbolName("emptyAsNull"))).getValue()
.booleanValue();
// Pass dependencies required by the metadata in through its constructor
return new StringTrimmerBinderMetadata(metadataIdentificationString,
aspectName, governorPhysicalTypeMetadata, emptyAsNull);
}
示例15: getWSDLFromClass
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入依赖的package包/类
/**
* Returns the wsdl document for a proxy class
*
* @param serviceClass
* @return wsdl or null if it's not a proxy class
*/
public Document getWSDLFromClass(JavaType serviceClass) {
// get class
ClassOrInterfaceTypeDetails importedServiceDetails = typeLocationService
.getTypeDetails(serviceClass);
AnnotationMetadata annotation = javaParserService.getAnnotation(
GvNIXWebServiceProxy.class.getName(), importedServiceDetails);
if (annotation == null) {
return null;
}
Document wsdl = securityService.getWsdl((String) annotation
.getAttribute(new JavaSymbolName("wsdlLocation")).getValue());
return wsdl;
}