本文整理汇总了Java中org.jboss.jandex.ClassInfo.superName方法的典型用法代码示例。如果您正苦于以下问题:Java ClassInfo.superName方法的具体用法?Java ClassInfo.superName怎么用?Java ClassInfo.superName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.jandex.ClassInfo
的用法示例。
在下文中一共展示了ClassInfo.superName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findRootEntityClassInfo
import org.jboss.jandex.ClassInfo; //导入方法依赖的package包/类
/**
* Finds the root entity starting at the entity given by {@code info}. The root entity is not the highest superclass
* in a java type sense, but the highest superclass which is also an entity (annotated w/ {@code @Entity}.
*
* @param index the annotation repository
* @param info the class info representing an entity
*
* @return Finds the root entity starting at the entity given by {@code info}
*/
private static ClassInfo findRootEntityClassInfo(Index index, ClassInfo info) {
ClassInfo rootEntity = info;
DotName superName = info.superName();
ClassInfo tmpInfo;
// walk up the hierarchy until java.lang.Object
while ( !OBJECT.equals( superName ) ) {
tmpInfo = index.getClassByName( superName );
if ( isEntityClass( tmpInfo ) ) {
rootEntity = tmpInfo;
}
superName = tmpInfo.superName();
}
return rootEntity;
}
示例2: build
import org.jboss.jandex.ClassInfo; //导入方法依赖的package包/类
/**
* Build new {@link Index} with mocked annotations from orm.xml.
* This method should be only called once per {@org.hibernate.metamodel.source.annotations.xml.mocker.IndexBuilder IndexBuilder} instance.
*
* @param globalDefaults Global defaults from <persistence-unit-metadata>, or null.
*
* @return Index.
*/
Index build(EntityMappingsMocker.Default globalDefaults) {
//merge annotations that not overrided by xml into the new Index
for ( ClassInfo ci : index.getKnownClasses() ) {
DotName name = ci.name();
if ( indexedClassInfoAnnotationsMap.containsKey( name ) ) {
//this class has been overrided by orm.xml
continue;
}
if ( ci.annotations() != null && !ci.annotations().isEmpty() ) {
Map<DotName, List<AnnotationInstance>> tmp = new HashMap<DotName, List<AnnotationInstance>>( ci.annotations() );
DefaultConfigurationHelper.INSTANCE.applyDefaults( tmp, globalDefaults );
mergeAnnotationMap( tmp, annotations );
classes.put( name, ci );
if ( ci.superName() != null ) {
addSubClasses( ci.superName(), ci );
}
if ( ci.interfaces() != null && ci.interfaces().length > 0 ) {
addImplementors( ci.interfaces(), ci );
}
}
}
return Index.create(
annotations, subclasses, implementors, classes
);
}
示例3: getAccessFromIdPosition
import org.jboss.jandex.ClassInfo; //导入方法依赖的package包/类
static JaxbAccessType getAccessFromIdPosition(DotName className, IndexBuilder indexBuilder) {
Map<DotName, List<AnnotationInstance>> indexedAnnotations = indexBuilder.getIndexedAnnotations( className );
Map<DotName, List<AnnotationInstance>> ormAnnotations = indexBuilder.getClassInfoAnnotationsMap( className );
JaxbAccessType accessType = getAccessFromIdPosition( ormAnnotations );
if ( accessType == null ) {
accessType = getAccessFromIdPosition( indexedAnnotations );
}
if ( accessType == null ) {
ClassInfo parent = indexBuilder.getClassInfo( className );
if ( parent == null ) {
parent = indexBuilder.getIndexedClassInfo( className );
}
if ( parent != null ) {
DotName parentClassName = parent.superName();
accessType = getAccessFromIdPosition( parentClassName, indexBuilder );
}
}
return accessType;
}
示例4: getEntityAccess
import org.jboss.jandex.ClassInfo; //导入方法依赖的package包/类
static JaxbAccessType getEntityAccess(DotName className, IndexBuilder indexBuilder) {
Map<DotName, List<AnnotationInstance>> indexedAnnotations = indexBuilder.getIndexedAnnotations( className );
Map<DotName, List<AnnotationInstance>> ormAnnotations = indexBuilder.getClassInfoAnnotationsMap( className );
JaxbAccessType accessType = getAccess( ormAnnotations );
if ( accessType == null ) {
accessType = getAccess( indexedAnnotations );
}
if ( accessType == null ) {
ClassInfo parent = indexBuilder.getClassInfo( className );
if ( parent == null ) {
parent = indexBuilder.getIndexedClassInfo( className );
}
if ( parent != null ) {
DotName parentClassName = parent.superName();
accessType = getEntityAccess( parentClassName, indexBuilder );
}
}
return accessType;
}
示例5: implementsMethodRecursive
import org.jboss.jandex.ClassInfo; //导入方法依赖的package包/类
/**
*
* @param i
* @param methodReference
* @param ci
* @return whether any superclass implements the method
*/
public static boolean implementsMethodRecursive ( Index i, MethodReference methodReference, ClassInfo ci ) {
if ( implementsMethod(methodReference, ci) ) {
return true;
}
DotName superName = ci.superName();
if ( superName != null ) {
ClassInfo superByName = i.getClassByName(superName);
if ( superByName == null || "java.lang.Object".equals(superByName.name().toString()) ) { //$NON-NLS-1$
return false;
}
return implementsMethodRecursive(i, methodReference, superByName);
}
return false;
}
示例6: findOverrideMethods
import org.jboss.jandex.ClassInfo; //导入方法依赖的package包/类
private static List<MethodInfo> findOverrideMethods(final Index index, final ClassInfo clasz,
final MethodInfo methodToFind, final int level) {
final List<MethodInfo> methods = new ArrayList<>();
if (clasz != null) {
// Super classes
if (level > 0) {
addIfFound(index, clasz, methodToFind, methods);
}
// Check interfaces
methods.addAll(findInterfaceMethods(index, clasz, methodToFind));
// Check super class
final DotName superName = clasz.superName();
final ClassInfo superClass = index.getClassByName(superName);
methods.addAll(findOverrideMethods(index, superClass, methodToFind, (level + 1)));
}
return methods;
}
示例7: processDefaultJpaCallbacks
import org.jboss.jandex.ClassInfo; //导入方法依赖的package包/类
private void processDefaultJpaCallbacks(String instanceCallbackClassName, List<JpaCallbackClass> jpaCallbackClassList) {
ClassInfo callbackClassInfo = getLocalBindingContext().getClassInfo( instanceCallbackClassName );
// Process superclass first if available and not excluded
if ( JandexHelper.getSingleAnnotation( callbackClassInfo, JPADotNames.EXCLUDE_SUPERCLASS_LISTENERS ) != null ) {
DotName superName = callbackClassInfo.superName();
if ( superName != null ) {
processDefaultJpaCallbacks( instanceCallbackClassName, jpaCallbackClassList );
}
}
String callbackClassName = callbackClassInfo.name().toString();
Map<Class<?>, String> callbacksByType = new HashMap<Class<?>, String>();
createDefaultCallback(
PrePersist.class, PseudoJpaDotNames.DEFAULT_PRE_PERSIST, callbackClassName, callbacksByType
);
createDefaultCallback(
PreRemove.class, PseudoJpaDotNames.DEFAULT_PRE_REMOVE, callbackClassName, callbacksByType
);
createDefaultCallback(
PreUpdate.class, PseudoJpaDotNames.DEFAULT_PRE_UPDATE, callbackClassName, callbacksByType
);
createDefaultCallback(
PostLoad.class, PseudoJpaDotNames.DEFAULT_POST_LOAD, callbackClassName, callbacksByType
);
createDefaultCallback(
PostPersist.class, PseudoJpaDotNames.DEFAULT_POST_PERSIST, callbackClassName, callbacksByType
);
createDefaultCallback(
PostRemove.class, PseudoJpaDotNames.DEFAULT_POST_REMOVE, callbackClassName, callbacksByType
);
createDefaultCallback(
PostUpdate.class, PseudoJpaDotNames.DEFAULT_POST_UPDATE, callbackClassName, callbacksByType
);
if ( !callbacksByType.isEmpty() ) {
jpaCallbackClassList.add( new JpaCallbackClassImpl( instanceCallbackClassName, callbacksByType, true ) );
}
}
示例8: processJpaCallbacks
import org.jboss.jandex.ClassInfo; //导入方法依赖的package包/类
private void processJpaCallbacks(String instanceCallbackClassName, boolean isListener, List<JpaCallbackClass> callbackClassList) {
ClassInfo callbackClassInfo = getLocalBindingContext().getClassInfo( instanceCallbackClassName );
// Process superclass first if available and not excluded
if ( JandexHelper.getSingleAnnotation( callbackClassInfo, JPADotNames.EXCLUDE_SUPERCLASS_LISTENERS ) != null ) {
DotName superName = callbackClassInfo.superName();
if ( superName != null ) {
processJpaCallbacks(
instanceCallbackClassName,
isListener,
callbackClassList
);
}
}
Map<Class<?>, String> callbacksByType = new HashMap<Class<?>, String>();
createCallback( PrePersist.class, JPADotNames.PRE_PERSIST, callbacksByType, callbackClassInfo, isListener );
createCallback( PreRemove.class, JPADotNames.PRE_REMOVE, callbacksByType, callbackClassInfo, isListener );
createCallback( PreUpdate.class, JPADotNames.PRE_UPDATE, callbacksByType, callbackClassInfo, isListener );
createCallback( PostLoad.class, JPADotNames.POST_LOAD, callbacksByType, callbackClassInfo, isListener );
createCallback( PostPersist.class, JPADotNames.POST_PERSIST, callbacksByType, callbackClassInfo, isListener );
createCallback( PostRemove.class, JPADotNames.POST_REMOVE, callbacksByType, callbackClassInfo, isListener );
createCallback( PostUpdate.class, JPADotNames.POST_UPDATE, callbacksByType, callbackClassInfo, isListener );
if ( !callbacksByType.isEmpty() ) {
callbackClassList.add( new JpaCallbackClassImpl( instanceCallbackClassName, callbacksByType, isListener ) );
}
}
示例9: addMappedSuperclasses
import org.jboss.jandex.ClassInfo; //导入方法依赖的package包/类
private static void addMappedSuperclasses(Index index, ClassInfo info, List<ClassInfo> classInfoList) {
DotName superName = info.superName();
ClassInfo tmpInfo;
// walk up the hierarchy until java.lang.Object
while ( !OBJECT.equals( superName ) ) {
tmpInfo = index.getClassByName( superName );
if ( isMappedSuperclass( tmpInfo ) ) {
classInfoList.add( tmpInfo );
}
superName = tmpInfo.superName();
}
}
示例10: extendsClass
import org.jboss.jandex.ClassInfo; //导入方法依赖的package包/类
/**
* @param bInfo
* @param aInfo
* @return
* @throws SerianalyzerException
*/
private static boolean extendsClass ( Index i, ClassInfo extendor, ClassInfo base ) throws SerianalyzerException {
if ( extendor.equals(base) ) {
return true;
}
DotName superName = extendor.superName();
if ( superName != null ) {
ClassInfo superByName = i.getClassByName(superName);
if ( superByName == null ) {
throw new SerianalyzerException("Failed to find super class " + superName); //$NON-NLS-1$
}
return extendsClass(i, superByName, base);
}
return false;
}
示例11: __invoke
import org.jboss.jandex.ClassInfo; //导入方法依赖的package包/类
private static List<Method> __invoke(Class<?> clazz, Index index, Comparator<Method> comparator) throws NoSuchMethodException {
ArrayList methods = new ArrayList();
ClassInfo clazzInfo = index.getClassByName(DotName.createSimple(clazz.getName()));
for (MethodInfo method : clazzInfo.methods()) {
if (method.hasAnnotation(IndexFactory.SUBRESOURCE_META)) {
methods.add(clazz.getMethod(method.name()));
}
}
if (clazzInfo.superName() != null && clazz.getSuperclass() != java.lang.Object.class) {
index = IndexFactory.createIndex(clazz.getSuperclass());
return __invoke(clazz.getSuperclass(), index, comparator);
}
Collections.sort(methods, comparator);
return methods;
}
示例12: createClassInfo
import org.jboss.jandex.ClassInfo; //导入方法依赖的package包/类
ClassInfo createClassInfo(String className) {
if ( StringHelper.isEmpty( className ) ) {
throw new AssertionFailure( "Class Name used to create ClassInfo is empty." );
}
DotName classDotName = DotName.createSimple( className );
if ( classes.containsKey( classDotName ) ) {
//classInfoAnnotationsMap.put( classDotName, new HashMap<DotName, List<AnnotationInstance>>(classes.get( classDotName ).annotations()) );
return classes.get( classDotName );
}
Class clazz = serviceRegistry.getService( ClassLoaderService.class ).classForName( className );
DotName superName = null;
DotName[] interfaces = null;
short access_flag;
ClassInfo annClassInfo = index.getClassByName( classDotName );
if ( annClassInfo != null ) {
superName = annClassInfo.superName();
interfaces = annClassInfo.interfaces();
access_flag = annClassInfo.flags();
}
else {
Class superClass = clazz.getSuperclass();
if ( superClass != null ) {
superName = DotName.createSimple( superClass.getName() );
}
Class[] classInterfaces = clazz.getInterfaces();
if ( classInterfaces != null && classInterfaces.length > 0 ) {
interfaces = new DotName[classInterfaces.length];
for ( int i = 0; i < classInterfaces.length; i++ ) {
interfaces[i] = DotName.createSimple( classInterfaces[i].getName() );
}
}
access_flag = (short) ( clazz.getModifiers() | 0x20 );//(modifiers | ACC_SUPER)
}
Map<DotName, List<AnnotationInstance>> map = new HashMap<DotName, List<AnnotationInstance>>();
classInfoAnnotationsMap.put( classDotName, map );
ClassInfo classInfo = ClassInfo.create(
classDotName, superName, access_flag, interfaces, map
);
classes.put( classDotName, classInfo );
addSubClasses( superName, classInfo );
addImplementors( interfaces, classInfo );
return classInfo;
}
示例13: doCheckInSuperClasses
import org.jboss.jandex.ClassInfo; //导入方法依赖的package包/类
/**
* @param methodReference
* @param cl
* @param callers
* @return
* @throws IOException
*/
private boolean doCheckInSuperClasses ( MethodReference methodReference, Logger cl, Set<MethodReference> callers ) throws IOException {
DotName dn = methodReference.getTypeName();
ClassInfo ci = this.input.getIndex().getClassByName(dn);
do {
if ( ci == null || "java.lang.Object".equals(dn.toString()) ) { //$NON-NLS-1$
break;
}
DotName superName;
if ( ci.superName() == null ) {
superName = DotName.createSimple("java.lang.Object"); //$NON-NLS-1$
}
else {
superName = ci.superName();
}
if ( "java.lang.Object".equals(superName.toString()) && TypeUtil.isObjectMethod(methodReference) ) { //$NON-NLS-1$
return true;
}
ci = this.input.getIndex().getClassByName(superName);
if ( ci == null ) {
log.error("Failed to find super class " + superName); //$NON-NLS-1$
return false;
}
MethodReference superRef = methodReference.adaptToType(superName);
if ( TypeUtil.implementsMethod(methodReference, ci) && doCheckClassInternal(cl, methodReference, superRef) ) {
this.state.traceCalls(superRef, callers);
return true;
}
if ( cl.isDebugEnabled() ) {
cl.debug("Failed to find in " + superName); //$NON-NLS-1$
}
dn = superName;
}
while ( true );
return false;
}