public final class ReflectionUtility extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ReflectionUtility.NonExistingValueClass
This class indicates a non existing value in the name-to-value mapping
|
Modifier and Type | Field and Description |
---|---|
static String |
ALIAS_GET |
static String |
ALIAS_HAS |
static String |
ALIAS_IS |
static String |
ALIAS_SET |
static String |
ALIAS_TOSTRING |
static ReflectionUtility.NonExistingValueClass |
NON_EXISTING_VALUE |
Modifier and Type | Method and Description |
---|---|
static boolean |
hasGetterAttribute(Object anObject,
String anAttributeName,
Class<?> aReturnType)
This method tests whether the given java beans getter attribute is found
for the given object
|
static boolean |
hasSetterAttribute(Object anObject,
String anAttributeName,
Class<?> anAttributeType)
This method tests whether the given java beans setter attribute is found
for the given object
|
static void |
setAttribute(Object anObject,
org.refcodes.structure.Attribute anAttributeValueStruct)
This method sets a java beans attribute for the given object.
|
static void |
setAttribute(Object anObject,
String anAttributeName,
Object anAttributeValue)
This method sets a java beans attribute for the given object.
|
static org.refcodes.structure.Attribute[] |
toBeanAttributes(Object anObject)
This method uses reflection on order to analyze a given object.
|
public static final String ALIAS_SET
public static final String ALIAS_GET
public static final String ALIAS_HAS
public static final String ALIAS_IS
public static final String ALIAS_TOSTRING
public static final ReflectionUtility.NonExistingValueClass NON_EXISTING_VALUE
public static org.refcodes.structure.Attribute[] toBeanAttributes(Object anObject)
anObject
- The object to be analyzed.public static void setAttribute(Object anObject, String anAttributeName, Object anAttributeValue) throws NoSuchMethodException
anObject
- The object which's java beans method is to be called.anAttributeName
- The attribute name of the java beans method.anAttributeValue
- The value of the attribute to be set.NoSuchMethodException
- Description of the Exceptionpublic static void setAttribute(Object anObject, org.refcodes.structure.Attribute anAttributeValueStruct) throws NoSuchMethodException
anObject
- The object which's attribute is to be set.anAttributeValueStruct
- The name-to-value struct for the attrubute
to be set.NoSuchMethodException
- Description of the Exceptionpublic static boolean hasSetterAttribute(Object anObject, String anAttributeName, Class<?> anAttributeType)
anObject
- The object which is to be tested.anAttributeName
- The attribute name.anAttributeType
- The expected (sub-) type of the attributepublic static boolean hasGetterAttribute(Object anObject, String anAttributeName, Class<?> aReturnType)
anObject
- The object which is to be tested.anAttributeName
- The attribute name.aReturnType
- The expected (sub-) type of the return valueCopyright © 2017. All rights reserved.