当前位置: 首页>>代码示例>>Java>>正文


Java ClassInfo类代码示例

本文整理汇总了Java中org.jboss.jandex.ClassInfo的典型用法代码示例。如果您正苦于以下问题:Java ClassInfo类的具体用法?Java ClassInfo怎么用?Java ClassInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ClassInfo类属于org.jboss.jandex包,在下文中一共展示了ClassInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createCallback

import org.jboss.jandex.ClassInfo; //导入依赖的package包/类
private void createCallback(Class callbackTypeClass,
							DotName callbackTypeName,
							Map<Class<?>, String> callbacksByClass,
							ClassInfo callbackClassInfo,
							boolean isListener) {
	Map<DotName, List<AnnotationInstance>> annotations = callbackClassInfo.annotations();
	List<AnnotationInstance> annotationInstances = annotations.get( callbackTypeName );
	if ( annotationInstances == null ) {
		return;
	}
	for ( AnnotationInstance callbackAnnotation : annotationInstances ) {
		MethodInfo methodInfo = (MethodInfo) callbackAnnotation.target();
		validateMethod( methodInfo, callbackTypeClass, callbacksByClass, isListener );
		callbacksByClass.put( callbackTypeClass, methodInfo.name() );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:EntityClass.java

示例2: EmbeddableHierarchy

import org.jboss.jandex.ClassInfo; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private EmbeddableHierarchy(
		List<ClassInfo> classInfoList,
		String propertyName,
		AnnotationBindingContext context,
		AccessType defaultAccessType) {
	this.defaultAccessType = defaultAccessType;

	// the resolved type for the top level class in the hierarchy
	context.resolveAllTypes( classInfoList.get( classInfoList.size() - 1 ).name().toString() );

	embeddables = new ArrayList<EmbeddableClass>();
	ConfiguredClass parent = null;
	EmbeddableClass embeddable;
	for ( ClassInfo info : classInfoList ) {
		embeddable = new EmbeddableClass(
				info, propertyName, parent, defaultAccessType, context
		);
		embeddables.add( embeddable );
		parent = embeddable;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:EmbeddableHierarchy.java

示例3: ConfiguredClass

import org.jboss.jandex.ClassInfo; //导入依赖的package包/类
public ConfiguredClass(
		ClassInfo classInfo,
		AccessType defaultAccessType,
		ConfiguredClass parent,
		AnnotationBindingContext context) {
	this.parent = parent;
	this.classInfo = classInfo;
	this.clazz = context.locateClassByName( classInfo.toString() );
	this.configuredClassType = determineType();
	this.classAccessType = determineClassAccessType( defaultAccessType );
	this.customTuplizer = determineCustomTuplizer();

	this.simpleAttributeMap = new TreeMap<String, BasicAttribute>();
	this.idAttributeMap = new TreeMap<String, BasicAttribute>();
	this.associationAttributeMap = new TreeMap<String, AssociationAttribute>();

	this.localBindingContext = new EntityBindingContext( context, this );

	collectAttributes();
	attributeOverrideMap = Collections.unmodifiableMap( findAttributeOverrides() );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:ConfiguredClass.java

示例4: resolveEmbeddable

import org.jboss.jandex.ClassInfo; //导入依赖的package包/类
private void resolveEmbeddable(String attributeName, Class<?> type) {
	ClassInfo embeddableClassInfo = localBindingContext.getClassInfo( type.getName() );
	if ( embeddableClassInfo == null ) {
		String msg = String.format(
				"Attribute '%s#%s' is annotated with @Embedded, but '%s' does not seem to be annotated " +
						"with @Embeddable. Are all annotated classes added to the configuration?",
				getConfiguredClass().getSimpleName(),
				attributeName,
				type.getSimpleName()
		);
		throw new AnnotationException( msg );
	}

	localBindingContext.resolveAllTypes( type.getName() );
	EmbeddableHierarchy hierarchy = EmbeddableHierarchy.createEmbeddableHierarchy(
			localBindingContext.<Object>locateClassByName( embeddableClassInfo.toString() ),
			attributeName,
			classAccessType,
			localBindingContext
	);
	embeddedClasses.put( attributeName, hierarchy.getLeaf() );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:ConfiguredClass.java

示例5: getMemberAnnotations

import org.jboss.jandex.ClassInfo; //导入依赖的package包/类
public static Map<DotName, List<AnnotationInstance>> getMemberAnnotations(ClassInfo classInfo, String name) {
	if ( classInfo == null ) {
		throw new IllegalArgumentException( "classInfo cannot be null" );
	}

	if ( name == null ) {
		throw new IllegalArgumentException( "name cannot be null" );
	}

	Map<DotName, List<AnnotationInstance>> annotations = new HashMap<DotName, List<AnnotationInstance>>();
	for ( List<AnnotationInstance> annotationList : classInfo.annotations().values() ) {
		for ( AnnotationInstance instance : annotationList ) {
			String targetName = null;
			if ( instance.target() instanceof FieldInfo ) {
				targetName = ( (FieldInfo) instance.target() ).name();
			}
			else if ( instance.target() instanceof MethodInfo ) {
				targetName = ( (MethodInfo) instance.target() ).name();
			}
			if ( targetName != null && name.equals( targetName ) ) {
				addAnnotationToMap( instance, annotations );
			}
		}
	}
	return annotations;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:JandexHelper.java

示例6: 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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:EntityHierarchyBuilder.java

示例7: isEntityClass

import org.jboss.jandex.ClassInfo; //导入依赖的package包/类
/**
 * Checks whether the class info represents an entity.
 *
 * @param info the jandex class info
 *
 * @return {@code true} if the class represented by {@code info} is annotated with {@code @Entity}, {@code false} otherwise.
 */
private static boolean isEntityClass(ClassInfo info) {
	if ( info == null ) {
		return false;
	}

	// we are only interested in building the class hierarchies for @Entity
	AnnotationInstance jpaEntityAnnotation = JandexHelper.getSingleAnnotation( info, JPADotNames.ENTITY );
	if ( jpaEntityAnnotation == null ) {
		return false;
	}

	// some sanity checks
	AnnotationInstance mappedSuperClassAnnotation = JandexHelper.getSingleAnnotation(
			info, JPADotNames.MAPPED_SUPERCLASS
	);
	String className = info.toString();
	assertNotEntityAndMappedSuperClass( jpaEntityAnnotation, mappedSuperClassAnnotation, className );

	AnnotationInstance embeddableAnnotation = JandexHelper.getSingleAnnotation(
			info, JPADotNames.EMBEDDABLE
	);
	assertNotEntityAndEmbeddable( jpaEntityAnnotation, embeddableAnnotation, className );

	return true;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:33,代码来源:EntityHierarchyBuilder.java

示例8: determineDefaultAccessType

import org.jboss.jandex.ClassInfo; //导入依赖的package包/类
/**
 * @param classes the classes in the hierarchy
 *
 * @return Returns the default access type for the configured class hierarchy independent of explicit
 *         {@code AccessType} annotations. The default access type is determined by the placement of the
 *         annotations.
 */
private static AccessType determineDefaultAccessType(List<ClassInfo> classes) {
	AccessType accessTypeByEmbeddedIdPlacement = null;
	AccessType accessTypeByIdPlacement = null;
	for ( ClassInfo info : classes ) {
		List<AnnotationInstance> idAnnotations = info.annotations().get( JPADotNames.ID );
		List<AnnotationInstance> embeddedIdAnnotations = info.annotations().get( JPADotNames.EMBEDDED_ID );

		if ( CollectionHelper.isNotEmpty( embeddedIdAnnotations ) ) {
			accessTypeByEmbeddedIdPlacement = determineAccessTypeByIdPlacement( embeddedIdAnnotations );
		}
		if ( CollectionHelper.isNotEmpty( idAnnotations ) ) {
			accessTypeByIdPlacement = determineAccessTypeByIdPlacement( idAnnotations );
		}
	}
	if ( accessTypeByEmbeddedIdPlacement != null ) {
		return accessTypeByEmbeddedIdPlacement;
	}
	else if ( accessTypeByIdPlacement != null ) {
		return accessTypeByIdPlacement;
	}
	else {
		return throwIdNotFoundAnnotationException( classes );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:EntityHierarchyBuilder.java

示例9: getAccessFromIndex

import org.jboss.jandex.ClassInfo; //导入依赖的package包/类
protected AccessType getAccessFromIndex(DotName className) {
	Map<DotName, List<AnnotationInstance>> indexedAnnotations = indexBuilder.getIndexedAnnotations( className );
	List<AnnotationInstance> accessAnnotationInstances = indexedAnnotations.get( ACCESS );
	if ( MockHelper.isNotEmpty( accessAnnotationInstances ) ) {
		for ( AnnotationInstance annotationInstance : accessAnnotationInstances ) {
			if ( annotationInstance.target() != null && annotationInstance.target() instanceof ClassInfo ) {
				ClassInfo ci = (ClassInfo) ( annotationInstance.target() );
				if ( className.equals( ci.name() ) ) {
					//todo does ci need to have @Entity or @MappedSuperClass ??
					return AccessType.valueOf( annotationInstance.value().asEnum() );
				}
			}
		}
	}
	return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:EntityMocker.java

示例10: 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
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:34,代码来源:IndexBuilder.java

示例11: getIndexedAnnotations

import org.jboss.jandex.ClassInfo; //导入依赖的package包/类
public Map<DotName, List<AnnotationInstance>> getIndexedAnnotations(DotName name) {
	Map<DotName, List<AnnotationInstance>> map = indexedClassInfoAnnotationsMap.get( name );
	if ( map == null ) {
		ClassInfo ci = index.getClassByName( name );
		if ( ci == null || ci.annotations() == null ) {
			map = Collections.emptyMap();
		}
		else {
			map = new HashMap<DotName, List<AnnotationInstance>>( ci.annotations() );
			//here we ignore global annotations
			for ( DotName globalAnnotationName : DefaultConfigurationHelper.GLOBAL_ANNOTATIONS ) {
				if ( map.containsKey( globalAnnotationName ) ) {
					map.put( globalAnnotationName, Collections.<AnnotationInstance>emptyList() );
				}
			}
		}
		indexedClassInfoAnnotationsMap.put( name, map );
	}
	return map;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:IndexBuilder.java

示例12: targetEquals

import org.jboss.jandex.ClassInfo; //导入依赖的package包/类
/**
 * @param t1 can't be null
 * @param t2 can't be null
 */
public static boolean targetEquals(AnnotationTarget t1, AnnotationTarget t2) {
	if ( t1 == t2 ) {
		return true;
	}
	if ( t1 != null && t2 != null ) {

		if ( t1.getClass() == t2.getClass() ) {
			if ( t1.getClass() == ClassInfo.class ) {
				return ( (ClassInfo) t1 ).name().equals( ( (ClassInfo) t2 ).name() );
			}
			else if ( t1.getClass() == MethodInfo.class ) {
				return ( (MethodInfo) t1 ).name().equals( ( (MethodInfo) t2 ).name() );
			}
			else {
				return ( (FieldInfo) t1 ).name().equals( ( (FieldInfo) t2 ).name() );
			}
		}
	}
	return false;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:MockHelper.java

示例13: 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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:AccessHelper.java

示例14: 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;

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:AccessHelper.java

示例15: getAccess

import org.jboss.jandex.ClassInfo; //导入依赖的package包/类
private static JaxbAccessType getAccess(Map<DotName, List<AnnotationInstance>> annotations) {
	if ( annotations == null || annotations.isEmpty() || !isEntityObject( annotations ) ) {
		return null;
	}
	List<AnnotationInstance> accessAnnotationInstances = annotations.get( JPADotNames.ACCESS );
	if ( MockHelper.isNotEmpty( accessAnnotationInstances ) ) {
		for ( AnnotationInstance annotationInstance : accessAnnotationInstances ) {
			if ( annotationInstance.target() != null && annotationInstance.target() instanceof ClassInfo ) {
				return JandexHelper.getEnumValue(
						annotationInstance,
						"value",
						JaxbAccessType.class
				);
			}
		}
	}
	return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:AccessHelper.java


注:本文中的org.jboss.jandex.ClassInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。