class DAOReflectionUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
GETTER_PREFIX_1 |
static int |
GETTER_PREFIX_1_LENGTH |
static String |
GETTER_PREFIX_2 |
static int |
GETTER_PREFIX_2_LENGTH |
private static org.apache.log4j.Logger |
log |
static String |
SETTER_PREFIX |
private static int |
SETTER_PREFIX_LENGTH |
Constructor and Description |
---|
DAOReflectionUtils() |
Modifier and Type | Method and Description |
---|---|
(package private) static String |
convertGetterToSetterName(String name)
Converts a 'getField' to 'setField'.
|
(package private) static String |
convertToFieldName(String setterName)
Given a method name like "setSeveralWords", return the corresponding AO field, "SEVERAL_WORDS", so it can be
used in AO queries as table columns.
|
static <T> Method |
getGetterMethod(Class<T> type,
String setterName)
Returns the getter for 'type'.
|
static <T> Function<String,Method> |
getGetterMethodsCached(Class<T> type)
Same as
getGetterMethod(java.lang.Class<T>, java.lang.String) , except the Reflection calls are cached |
(package private) static Method |
getSetterMethod(Class<?> type,
String setterName) |
(package private) static boolean |
isGetterName(String name) |
(package private) static boolean |
isSetterForeignKey(Class<?> type,
String setterName,
Object argument)
Return true if the setter is related to a foreign key, i.e.
|
(package private) static boolean |
isSetterName(String name) |
private static final org.apache.log4j.Logger log
public static final String GETTER_PREFIX_1
public static final int GETTER_PREFIX_1_LENGTH
public static final String GETTER_PREFIX_2
public static final int GETTER_PREFIX_2_LENGTH
public static final String SETTER_PREFIX
private static final int SETTER_PREFIX_LENGTH
static boolean isGetterName(String name)
static boolean isSetterName(String name)
static String convertGetterToSetterName(@Nonnull String name)
static String convertToFieldName(String setterName)
static boolean isSetterForeignKey(Class<?> type, String setterName, Object argument)
public static <T> Method getGetterMethod(Class<T> type, @Nonnull String setterName)
setterName
- the setter name. Beware, we need to *setter* name, because the getter name can be is(), has() or get().
It must return true for isSetterName(name).public static <T> Function<String,Method> getGetterMethodsCached(Class<T> type)
getGetterMethod(java.lang.Class<T>, java.lang.String)
, except the Reflection calls are cachedCopyright © 2022 Requirement Yogi. All rights reserved.