本文整理汇总了Java中org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails.getName方法的典型用法代码示例。如果您正苦于以下问题:Java ClassOrInterfaceTypeDetails.getName方法的具体用法?Java ClassOrInterfaceTypeDetails.getName怎么用?Java ClassOrInterfaceTypeDetails.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails
的用法示例。
在下文中一共展示了ClassOrInterfaceTypeDetails.getName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFieldEntityPlural
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的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<Foo></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();
}
示例2: 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;
}
示例3: getDataOnDemandType
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
/**
* Returns the {@link JavaType} for the given entity's "data on demand"
* class.
*
* @param entity the entity for which to get the DoD type
* @return a non-<code>null</code> type (which may or may not exist yet)
*/
private JavaType getDataOnDemandType(final JavaType entity) {
// First check for an existing type with the standard DoD naming
// convention
final JavaType defaultDodType = new JavaType(
entity.getFullyQualifiedTypeName() + "DataOnDemand");
if (getTypeLocationService().getTypeDetails(defaultDodType) != null) {
return defaultDodType;
}
// Otherwise we look through all DoD-annotated classes for this entity's
// one
for (final ClassOrInterfaceTypeDetails dodType : getTypeLocationService()
.findClassesOrInterfaceDetailsWithAnnotation(ROO_DATA_ON_DEMAND)) {
final AnnotationMetadata dodAnnotation = MemberFindingUtils
.getFirstAnnotation(dodType, ROO_DATA_ON_DEMAND);
if (dodAnnotation != null
&& dodAnnotation.getAttribute("entity").getValue()
.equals(entity)) {
return dodType.getName();
}
}
// No existing DoD class was found for this entity, so use the default
// name
return defaultDodType;
}
示例4: annotateAll
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
public void annotateAll(JavaPackage javaPackage) {
if (javaPackage == null) {
javaPackage = projectOperations
.getTopLevelPackage(projectOperations
.getFocusedModuleName());
}
for (final ClassOrInterfaceTypeDetails cod : typeLocationService
.findClassesOrInterfaceDetailsWithAnnotation(RooJavaType.ROO_JSON)) {
if (Modifier.isAbstract(cod.getModifier())) {
continue;
}
final JavaType jsonType = cod.getName();
JavaType mvcType = null;
for (final ClassOrInterfaceTypeDetails mvcCod : typeLocationService
.findClassesOrInterfaceDetailsWithAnnotation(RooJavaType.ROO_WEB_SCAFFOLD)) {
// We know this physical type exists given type location service
// just found it.
final PhysicalTypeMetadata mvcMd = (PhysicalTypeMetadata) metadataService
.get(mvcCod.getDeclaredByMetadataId());
final WebScaffoldAnnotationValues webScaffoldAnnotationValues = new WebScaffoldAnnotationValues(
mvcMd);
if (webScaffoldAnnotationValues.isAnnotationFound()
&& webScaffoldAnnotationValues.getFormBackingObject()
.equals(jsonType)) {
mvcType = mvcCod.getName();
break;
}
}
if (mvcType == null) {
createNewType(
new JavaType(javaPackage.getFullyQualifiedPackageName()
+ "." + jsonType.getSimpleTypeName()
+ "Controller"), jsonType);
}
else {
appendToExistingType(mvcType, jsonType);
}
}
}
示例5: AbstractItdTypeDetailsProvidingMetadataItem
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
/**
* Validates input and constructs a superclass that implements
* {@link ItdTypeDetailsProvidingMetadataItem}.
* <p>
* Exposes the {@link ClassOrInterfaceTypeDetails} of the governor, if
* available. If they are not available, ensures {@link #isValid()} returns
* false.
* <p>
* Subclasses should generally return immediately if {@link #isValid()} is
* false. Subclasses should also attempt to set the {@link #itdTypeDetails}
* to contain the output of their ITD where {@link #isValid()} is true.
*
* @param identifier the identifier for this item of metadata (required)
* @param aspectName the Java type of the ITD (required)
* @param governorPhysicalTypeMetadata the governor, which is expected to
* contain a {@link ClassOrInterfaceTypeDetails} (required)
*/
protected AbstractItdTypeDetailsProvidingMetadataItem(
final String identifier, final JavaType aspectName,
final PhysicalTypeMetadata governorPhysicalTypeMetadata) {
super(identifier);
Validate.notNull(aspectName, "Aspect name required");
Validate.notNull(governorPhysicalTypeMetadata,
"Governor physical type metadata required");
this.aspectName = aspectName;
this.governorPhysicalTypeMetadata = governorPhysicalTypeMetadata;
final Object physicalTypeDetails = governorPhysicalTypeMetadata
.getMemberHoldingTypeDetails();
if (physicalTypeDetails instanceof ClassOrInterfaceTypeDetails) {
// We have reliable physical type details
governorTypeDetails = (ClassOrInterfaceTypeDetails) physicalTypeDetails;
}
else {
// There is a problem
valid = false;
}
destination = governorTypeDetails.getName();
// Provide the subclass a builder, to make preparing an ITD even easier
builder = new ItdTypeDetailsBuilder(getId(), governorTypeDetails,
aspectName, true);
}
示例6: generateManagedBeans
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
private void generateManagedBeans(final JavaPackage destinationPackage) {
if(metadataDependencyRegistry == null){
metadataDependencyRegistry = getMetadataDependencyRegistry();
}
Validate.notNull(metadataDependencyRegistry, "MetadataDependencyRegistry is required");
if(typeLocationService == null){
typeLocationService = getTypeLocationService();
}
Validate.notNull(typeLocationService, "TypeLocationService is required");
for (final ClassOrInterfaceTypeDetails cid : typeLocationService
.findClassesOrInterfaceDetailsWithTag(CustomDataKeys.PERSISTENT_TYPE)) {
if (Modifier.isAbstract(cid.getModifier())) {
continue;
}
final JavaType entity = cid.getName();
final LogicalPath path = PhysicalTypeIdentifier.getPath(cid
.getDeclaredByMetadataId());
// Check to see if this persistent type has a JSF metadata listening
// to it
final String downstreamJsfMetadataId = JsfManagedBeanMetadata
.createIdentifier(entity, path);
if (metadataDependencyRegistry.getDownstream(
cid.getDeclaredByMetadataId()).contains(
downstreamJsfMetadataId)) {
// There is already a JSF managed bean for this entity
continue;
}
// To get here, there is no listening managed bean, so add one
final JavaType managedBean = new JavaType(
destinationPackage.getFullyQualifiedPackageName() + "."
+ entity.getSimpleTypeName() + "Bean");
final String beanName = StringUtils.uncapitalize(managedBean
.getSimpleTypeName());
createManagedBean(managedBean, entity, beanName, true);
}
}
示例7: OCCChecksumMetadata
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
public OCCChecksumMetadata(String identifier, JavaType aspectName,
PhysicalTypeMetadata governorPhysicalTypeMetadata,
JpaActiveRecordMetadata entityMetadata,
MemberDetailsScanner memberDetailsScanner,
TypeManagementService typeManagementService,
PersistenceMemberLocator persistenceMemberLocator,
FieldMetadata idField, FieldMetadata versionField) {
// From AbstractItdTypeDetailsProvidingMetadataItem
super(identifier);
Validate.notNull(aspectName, "Aspect name required");
Validate.notNull(governorPhysicalTypeMetadata,
"Governor physical type metadata required");
this.aspectName = aspectName;
this.governorPhysicalTypeMetadata = governorPhysicalTypeMetadata;
// DiSiD: Initialize memberDetailsScanner
this.memberDetailsScanner = memberDetailsScanner;
this.persistenceMemberLocator = persistenceMemberLocator;
this.idField = idField;
this.versionField = versionField;
PhysicalTypeDetails physicalTypeDetails = governorPhysicalTypeMetadata
.getMemberHoldingTypeDetails();
if (!(physicalTypeDetails instanceof ClassOrInterfaceTypeDetails)) {
// There is a problem
valid = false;
}
else {
// We have reliable physical type details
governorTypeDetails = (ClassOrInterfaceTypeDetails) physicalTypeDetails;
}
this.destination = governorTypeDetails.getName();
Validate.isTrue(isValid(identifier), "Metadata identification string '"
+ identifier + "' does not appear to be a valid");
if (entityMetadata != null) {
this.entityMetadata = entityMetadata;
if (!isValid()) {
return;
}
// Process values from the annotation, if present
AnnotationMetadata annotation = MemberFindingUtils
.getDeclaredTypeAnnotation(
governorTypeDetails,
new JavaType(GvNIXEntityOCCChecksum.class.getName()));
if (annotation != null) {
AutoPopulationUtils.populate(this, annotation);
}
// Adds field to entity java file add persist it
FieldMetadata field = getChecksumField();
MethodMetadata getter = getChecksumAccessor();
MethodMetadata setter = getChecksumMutator();
addChecksumFieldToEntity(field, getter, setter,
typeManagementService);
// Generates ITD
itdFileContents = generateITDContents(field,
persistenceMemberLocator);
}
}
示例8: generateAll
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
public void generateAll(JavaPackage javaPackage) {
Set<ClassOrInterfaceTypeDetails> cids = typeLocationService
.findClassesOrInterfaceDetailsWithAnnotation(new JavaType(
RooJpaActiveRecord.class.getName()));
for (ClassOrInterfaceTypeDetails cid : cids) {
if (Modifier.isAbstract(cid.getModifier())) {
continue;
}
JavaType javaType = cid.getName();
LogicalPath path = PhysicalTypeIdentifier.getPath(cid
.getDeclaredByMetadataId());
JpaActiveRecordMetadata entityMetadata = (JpaActiveRecordMetadata) metadataService
.get(JpaActiveRecordMetadata.createIdentifier(javaType,
path));
if (entityMetadata == null || (!entityMetadata.isValid())) {
continue;
}
// Check to see if this entity metadata has a flex scaffold metadata
// listening to it
String dwnstrmFlexScaffMDataId = FlexScaffoldMetadata
.createIdentifier(javaType, path);
if (dependencyRegistry.getDownstream(entityMetadata.getId())
.contains(dwnstrmFlexScaffMDataId)) {
// There is already Flex scaffolding this entity
continue;
}
// to get here, there is no listening service, so add one
JavaType service = new JavaType(
javaPackage.getFullyQualifiedPackageName() + "."
+ javaType.getSimpleTypeName() + "Service");
createRemotingDestination(service, javaType);
}
}