本文整理汇总了Java中org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails.getSuperclass方法的典型用法代码示例。如果您正苦于以下问题:Java ClassOrInterfaceTypeDetails.getSuperclass方法的具体用法?Java ClassOrInterfaceTypeDetails.getSuperclass怎么用?Java ClassOrInterfaceTypeDetails.getSuperclass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails
的用法示例。
在下文中一共展示了ClassOrInterfaceTypeDetails.getSuperclass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEntitySuperclass
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
private ClassOrInterfaceTypeDetails getEntitySuperclass(
final JavaType entity) {
final String physicalTypeIdentifier = PhysicalTypeIdentifier
.createIdentifier(entity,
getTypeLocationService().getTypePath(entity));
final PhysicalTypeMetadata ptm = (PhysicalTypeMetadata) getMetadataService()
.get(physicalTypeIdentifier);
Validate.notNull(ptm, "Java source code unavailable for type %s",
PhysicalTypeIdentifier.getFriendlyName(physicalTypeIdentifier));
final PhysicalTypeDetails ptd = ptm.getMemberHoldingTypeDetails();
Validate.notNull(ptd,
"Java source code details unavailable for type %s",
PhysicalTypeIdentifier.getFriendlyName(physicalTypeIdentifier));
Validate.isInstanceOf(ClassOrInterfaceTypeDetails.class, ptd,
"Java source code is immutable for type %s",
PhysicalTypeIdentifier.getFriendlyName(physicalTypeIdentifier));
final ClassOrInterfaceTypeDetails cid = (ClassOrInterfaceTypeDetails) ptd;
return cid.getSuperclass();
}
示例2: getParentMetadata
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
/**
* Looks up the given type's inheritance hierarchy for metadata of the given
* type, starting with the given type's parent and going upwards until the
* first such instance is found (i.e. lower level metadata takes priority
* over higher level metadata)
*
* @param <T> the type of metadata to look for
* @param child the child type whose parents to search (required)
* @return <code>null</code> if there is no such metadata
*/
@SuppressWarnings("unchecked")
protected <T extends MetadataItem> T getParentMetadata(
final ClassOrInterfaceTypeDetails child) {
T parentMetadata = null;
ClassOrInterfaceTypeDetails superCid = child.getSuperclass();
while (parentMetadata == null && superCid != null) {
final String superCidPhysicalTypeIdentifier = superCid
.getDeclaredByMetadataId();
final LogicalPath path = PhysicalTypeIdentifier
.getPath(superCidPhysicalTypeIdentifier);
final String superCidLocalIdentifier = createLocalIdentifier(
superCid.getName(), path);
parentMetadata = (T) getMetadataService().get(superCidLocalIdentifier);
superCid = superCid.getSuperclass();
}
return parentMetadata; // Could be null
}
示例3: isImplementing
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
/**
* Determines if the presented class (or any of its superclasses) implements
* the target interface.
*
* @param clazz the cid to search
* @param interfaceTarget the interface to locate
* @return true if the class or any of its superclasses contains the
* specified interface
*/
protected boolean isImplementing(final ClassOrInterfaceTypeDetails clazz,
final JavaType interfaceTarget) {
if (clazz.getImplementsTypes().contains(interfaceTarget)) {
return true;
}
if (clazz.getSuperclass() != null) {
return isImplementing(clazz.getSuperclass(), interfaceTarget);
}
return false;
}
示例4: getMemberHoldingDetails
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails; //导入方法依赖的package包/类
/**
* Retrieve all related ITDs to {@link ClassOrInterfaceTypeDetails} with all
* information.
*
* @param governorTypeDetails Class to retrieve all related ITD information.
* @param governorPhysicalTypeMetadata Physical Metadata.
* @param metadataIdentificationString Identify this Metadata.
* @return List of {@link MemberHoldingTypeDetails} information.
*/
public List<MemberHoldingTypeDetails> getMemberHoldingDetails(
ClassOrInterfaceTypeDetails governorTypeDetails,
PhysicalTypeMetadata governorPhysicalTypeMetadata,
String metadataIdentificationString) {
// Create a list of discovered members
// BeanInfoMetadataProviderImpl.class.getName()
List<MemberHoldingTypeDetails> memberHoldingTypeDetails = new ArrayList<MemberHoldingTypeDetails>();
// Build a List representing the class hierarchy, where the first
// element is the absolute superclass
List<ClassOrInterfaceTypeDetails> cidHierarchy = new ArrayList<ClassOrInterfaceTypeDetails>();
while (governorTypeDetails != null) {
cidHierarchy.add(0, governorTypeDetails); // note to the top of the
// list
governorTypeDetails = governorTypeDetails.getSuperclass();
}
// Now we add this governor, plus all of its superclasses
for (ClassOrInterfaceTypeDetails currentClass : cidHierarchy) {
memberHoldingTypeDetails.add(currentClass);
MetadataItem metadataItem = metadataService.get(currentClass
.getDeclaredByMetadataId());
if (metadataItem == null || !metadataItem.isValid()) {
continue;
}
if (!(metadataItem instanceof ItdTypeDetailsProvidingMetadataItem)) {
continue;
}
ItdTypeDetailsProvidingMetadataItem itdTypeDetailsMd = (ItdTypeDetailsProvidingMetadataItem) metadataItem;
if (itdTypeDetailsMd.getMemberHoldingTypeDetails() == null) {
continue;
}
getMetadataDependencyRegistry().registerDependency(
metadataItem.getId(), metadataIdentificationString);
// Include its accessors
memberHoldingTypeDetails.add(itdTypeDetailsMd
.getMemberHoldingTypeDetails());
}
return memberHoldingTypeDetails;
}