|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.castor.jdo.jpa.processors.ReflectionsHelper
public final class ReflectionsHelper
Tool class that offers methods to retrieve information from
AnnotatedElements (Methods or Fields).
| Method Summary | |
|---|---|
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)
Return a setter Method for a given getter Method. |
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. starts with "get" or "is". |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
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
Method for a given getter Method.
getter - The getter Method
NoSuchMethodException - If the setter method does not exist
SecurityException - If the setter method is not accessiblepublic static boolean isGetter(Method method)
Method is a getter method,
i.e. starts with "get" or "is".
method - the Method to check.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||