|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.healthmarketscience.common.util.ClassUtil
public class ClassUtil
Static utility methods for working with classes and reflection.
| Constructor Summary | |
|---|---|
ClassUtil()
|
|
| Method Summary | ||
|---|---|---|
static boolean |
fieldIsBoolean(Field field)
Test if the field is a Boolean or boolean. |
|
static
|
findAnnotatedElements(Class<AType> annotationClass,
MType... members)
Search for elements (fields or methods) which have the given annotation. |
|
static
|
findAnnotatedFields(Object instance,
Class<AType> annotationClass,
boolean inherit)
Get a collection of fields of the given object with the given annotation. |
|
static
|
findAnnotatedMethods(Object instance,
Class<AType> annotationClass,
boolean inherit)
Get a collection of methods of the given object with the given annotation. |
|
static boolean |
isBoolean(Class<?> clazz)
Test if the class is Boolean or boolean. |
|
static boolean |
methodTakesBoolean(Method method)
Test if the method takes one and only one arg which is a Boolean or boolean. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ClassUtil()
| Method Detail |
|---|
public static <AType extends Annotation> Collection<Tuple2<AType,Field>> findAnnotatedFields(Object instance,
Class<AType> annotationClass,
boolean inherit)
AType - the type of the annotation to look for.instance - the object to scan for annotated fields.annotationClass - the type of the annotation to look for.inherit - whether to get fields from super classes.
public static <AType extends Annotation> Collection<Tuple2<AType,Method>> findAnnotatedMethods(Object instance,
Class<AType> annotationClass,
boolean inherit)
AType - the type of the annotation to look for.instance - the object to scan for annotated methods.annotationClass - the type of the annotation to look for.inherit - whether to get methods from super classes.
public static <AType extends Annotation,MType extends AnnotatedElement> Collection<Tuple2<AType,MType>> findAnnotatedElements(Class<AType> annotationClass,
MType... members)
annotationClass - the annotation to search formembers - the members to search over
public static boolean isBoolean(Class<?> clazz)
public static boolean methodTakesBoolean(Method method)
public static boolean fieldIsBoolean(Field field)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||