Package org.jboss.weld.environment.util
Class Reflections
- java.lang.Object
-
- org.jboss.weld.environment.util.Reflections
-
public final class Reflections extends Object
Reflection utilities.- Author:
- Pete Muir, Martin Kouba
-
-
Field Summary
Fields Modifier and Type Field Description static List<Class<? extends Annotation>>
META_ANNOTATIONS
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
cast(Object obj)
static <T> Class<T>
classForName(org.jboss.weld.resources.spi.ResourceLoader resourceLoader, String className)
First try to load a class using the specified ResourceLoader.static boolean
containsAnnotation(Class<?> javaClass, Class<? extends Annotation> requiredAnnotation)
static boolean
containsAnnotations(Annotation[] annotations, Class<? extends Annotation> requiredAnnotation)
static boolean
hasBeanDefiningAnnotation(Class<?> clazz, Set<Class<? extends Annotation>> initialBeanDefiningAnnotations)
static boolean
hasBeanDefiningMetaAnnotationSpecified(Annotation[] annotations, Class<? extends Annotation> metaAnnotationType)
static boolean
isClassLoadable(org.jboss.weld.resources.spi.ResourceLoader resourceLoader, String className)
static <T> Class<T>
loadClass(org.jboss.weld.resources.spi.ResourceLoader resourceLoader, String className)
-
-
-
Field Detail
-
META_ANNOTATIONS
public static final List<Class<? extends Annotation>> META_ANNOTATIONS
-
-
Method Detail
-
containsAnnotation
public static boolean containsAnnotation(Class<?> javaClass, Class<? extends Annotation> requiredAnnotation)
-
cast
public static <T> T cast(Object obj)
-
isClassLoadable
public static boolean isClassLoadable(org.jboss.weld.resources.spi.ResourceLoader resourceLoader, String className)
- Parameters:
resourceLoader
-className
-- Returns:
true
if a class with the given name can be loaded,false
otherwise- See Also:
loadClass(ResourceLoader, String)
-
loadClass
public static <T> Class<T> loadClass(org.jboss.weld.resources.spi.ResourceLoader resourceLoader, String className)
- Parameters:
resourceLoader
-className
-- Returns:
- the loaded class or null if the given class cannot be loaded
- See Also:
classForName(ResourceLoader, String)
-
classForName
public static <T> Class<T> classForName(org.jboss.weld.resources.spi.ResourceLoader resourceLoader, String className)
First try to load a class using the specified ResourceLoader. If not successful, tryClass.forName(String)
as a fallback.- Parameters:
resourceLoader
-className
-- Returns:
- the loaded class
-
hasBeanDefiningMetaAnnotationSpecified
public static boolean hasBeanDefiningMetaAnnotationSpecified(Annotation[] annotations, Class<? extends Annotation> metaAnnotationType)
- Parameters:
annotations
-metaAnnotationType
-- Returns:
true
if any of the annotations specified has the given meta annotation type specified,false
otherwise
-
containsAnnotations
public static boolean containsAnnotations(Annotation[] annotations, Class<? extends Annotation> requiredAnnotation)
-
hasBeanDefiningAnnotation
public static boolean hasBeanDefiningAnnotation(Class<?> clazz, Set<Class<? extends Annotation>> initialBeanDefiningAnnotations)
-
-