public final class ReflectionsHelper
extends java.lang.Object
AnnotatedElement
s (Methods or Fields).Modifier and Type | Method | Description |
---|---|---|
static java.lang.Class<?> |
getCollectionType(java.lang.reflect.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 java.lang.String |
getFieldnameFromGetter(java.lang.reflect.Method getter) |
Little helper to get a field (bean property) name from a getter method.
|
static java.lang.reflect.Method |
getSetterMethodFromGetter(java.lang.reflect.Method getter) |
Return a setter
Method for a given getter Method . |
static java.lang.Class<?> |
getTargetEntityFromGenerics(java.lang.reflect.AnnotatedElement target) |
Get the target entity information from the target (necessary if it was
not specified by the annotation itself).
|
static boolean |
isGetter(java.lang.reflect.Method method) |
Convenience method to check whether a
Method is a getter method,
i.e. |
public static java.lang.Class<?> getCollectionType(java.lang.reflect.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 java.lang.Class<?> getTargetEntityFromGenerics(java.lang.reflect.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 java.lang.String getFieldnameFromGetter(java.lang.reflect.Method getter)
getFoo() => "foo"
isBar() => "bar"
getter
- the Method
to analyse.public static java.lang.reflect.Method getSetterMethodFromGetter(java.lang.reflect.Method getter) throws java.lang.SecurityException, java.lang.NoSuchMethodException
Method
for a given getter Method
.getter
- The getter Method
java.lang.NoSuchMethodException
- If the setter method does not existjava.lang.SecurityException
- If the setter method is not accessiblepublic static boolean isGetter(java.lang.reflect.Method method)
Method
is a getter method,
i.e. starts with "get" or "is".method
- the Method
to check.Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com