public final class ReflectionsHelper extends Object
AnnotatedElements (Methods or Fields).| Modifier and Type | Method and Description |
|---|---|
static Class<?> |
getCollectionType(AnnotatedElement target,
boolean jpaTypesOnly)
Get the (raw) type of collection from the annotations target and optional
check for JPA 1.0 restrictions (only Collection, Map, List and Set are
allowed).
|
static String |
getFieldnameFromGetter(Method getter)
Little helper to get a field (bean property) name from a getter method.
|
static Method |
getSetterMethodFromGetter(Method getter)
|
static Class<?> |
getTargetEntityFromGenerics(AnnotatedElement target)
Get the target entity information from the target (necessary if it was
not specified by the annotation itself).
|
static boolean |
isGetter(Method method)
Convenience method to check whether a
Method is a getter method,
i.e. |
public static Class<?> getCollectionType(AnnotatedElement target, boolean jpaTypesOnly) throws AnnotationTargetException
target - The ManyToMany annotations target.jpaTypesOnly - If set to true only Collection types of JPA 1.0 are allowed.
Others will lead to a thrown Exception.AnnotationTargetException - if the raw collection type can not be inferred from the type
definition or if the type is not supported by JPA 1.0 and
jpaTypesOnly was set to true.public static Class<?> getTargetEntityFromGenerics(AnnotatedElement target) throws AnnotationTargetException
target - The *ToMany annotations target. This method will fail if
target is not of Type Field or Method!AnnotationTargetException - if the generic definition is not sufficientpublic static String getFieldnameFromGetter(Method getter)
getFoo() => "foo"isBar() => "bar"getter - the Method to analyse.public static Method getSetterMethodFromGetter(Method getter) throws SecurityException, NoSuchMethodException
getter - The getter MethodNoSuchMethodException - If the setter method does not existSecurityException - If the setter method is not accessibleCopyright © 2014. All rights reserved.