Package org.openxava.util
Class Classes
- java.lang.Object
-
- org.openxava.util.Classes
-
public class Classes extends java.lang.Object
Utility class to work with classes.
-
-
Constructor Summary
Constructors Constructor Description Classes()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getAnnotationAttributeValue(java.lang.annotation.Annotation annotation, java.lang.String attribute)
static java.lang.annotation.Annotation[]
getAnnotationsWithRepeatables(java.lang.reflect.AnnotatedElement element)
static java.lang.reflect.Field
getField(java.lang.Class theClass, java.lang.String fieldName)
Get a field of the specified class or any of its subclasses, even if it is private.static java.util.Collection<java.lang.reflect.Field>
getFieldsAnnotatedWith(java.lang.Class theClass, java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
All fields from all superclasess and including private, protected and public.static java.util.Collection<java.lang.reflect.Method>
getMethodsAnnotatedWith(java.lang.Class theClass, java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Returns the collection of methods with the given annotationstatic boolean
hasMethod(java.lang.Class theClass, java.lang.String method)
If the class contains the exact method without argumetns.
-
-
-
Method Detail
-
hasMethod
public static boolean hasMethod(java.lang.Class theClass, java.lang.String method)
If the class contains the exact method without argumetns.
-
getFieldsAnnotatedWith
public static java.util.Collection<java.lang.reflect.Field> getFieldsAnnotatedWith(java.lang.Class theClass, java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
All fields from all superclasess and including private, protected and public.- Parameters:
theClass
-- Returns:
-
getField
public static java.lang.reflect.Field getField(java.lang.Class theClass, java.lang.String fieldName) throws java.lang.NoSuchFieldException
Get a field of the specified class or any of its subclasses, even if it is private.- Parameters:
theClass
- Class where we want to get the field- Returns:
- fieldName Name of the field we want to get
- Throws:
java.lang.NoSuchFieldException
- If the field is not present in theClass and in any of its subclasses- Since:
- 7.0
-
getMethodsAnnotatedWith
public static java.util.Collection<java.lang.reflect.Method> getMethodsAnnotatedWith(java.lang.Class theClass, java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Returns the collection of methods with the given annotation- Parameters:
theClass
- Class object to be examinedannotation
- Annotation type to be search for- Returns:
- a Collection of Method, never null, might be empty.
- Since:
- 4.0.1
-
getAnnotationAttributeValue
public static java.lang.String getAnnotationAttributeValue(java.lang.annotation.Annotation annotation, java.lang.String attribute)
- Since:
- 7.4
-
getAnnotationsWithRepeatables
public static java.lang.annotation.Annotation[] getAnnotationsWithRepeatables(java.lang.reflect.AnnotatedElement element)
- Since:
- 7.4
-
-