|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.epam.xml.utils.ReflectUtil
public final class ReflectUtil
Provides ability to work with generic type.
Constructor Summary | |
---|---|
ReflectUtil()
|
Method Summary | |
---|---|
static void |
clearAttributes(Object source,
Class<? extends Annotation> attributeMarker)
|
static String |
concateStrings(Object instance,
String value)
Concatenates the strings. |
static Object |
createGenericInstance(Class clazz)
Creates the generic instance if clazz. |
static Class<?> |
getClassInPath(String path,
String className)
|
static void |
invokeAddListValue(Object instance,
Object value,
Method method)
Invokes add to list method |
static void |
invokeAddToList(Object instance,
Method method,
String value,
Class<?> type)
Invokes the method |
static void |
invokeSetValue(Object instance,
Object value,
Method method)
Invokes the method. |
static void |
invokeSetValue(Object instance,
String value,
Class<?> type,
Method method)
Invokes the method |
static boolean |
isArray(Class<?> _class)
Returns true, if array. |
static boolean |
isArray(Method method)
Returns true if method for array type. |
static boolean |
isPrimitiveField(Class<?> type)
Checks if @type is primitive |
static Object |
parseValue(String value,
Class classType)
Creates a instance of classType with specified value. |
static String |
prepareSting(String propertyName,
boolean isUpper,
boolean setter)
Constructs the method name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReflectUtil()
Method Detail |
---|
public static Class<?> getClassInPath(String path, String className) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static String prepareSting(String propertyName, boolean isUpper, boolean setter)
propertyName
- the name of propertyisUpper
- if flag set to true, the first letter in property name replaced to uppper.setter
- the setter flag, if sets to true the method name concats
with set prefix, v.v get.public static Object parseValue(String value, Class classType)
value
- the valueclassType
- the class
RuntimeException
- if classType is undefinedpublic static Object createGenericInstance(Class clazz) throws InstantiationException, IllegalAccessException
clazz
- the class
InstantiationException
IllegalAccessException
public static boolean isPrimitiveField(Class<?> type)
type
- the typepublic static void invokeAddToList(Object instance, Method method, String value, Class<?> type) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException, InstantiationException
instance
- the instancemethod
- the methodvalue
- the valuetype
- the type
IllegalAccessException
InvocationTargetException
NoSuchMethodException
InstantiationException
public static void invokeAddListValue(Object instance, Object value, Method method)
instance
- the instancevalue
- the valuemethod
- the methodpublic static void invokeSetValue(Object instance, Object value, Method method)
instance
- the instancevalue
- the valuemethod
- the methodpublic static void invokeSetValue(Object instance, String value, Class<?> type, Method method) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException
instance
- the instancevalue
- the valuetype
- the typemethod
- the method
NoSuchMethodException
IllegalAccessException
InvocationTargetException
InstantiationException
public static boolean isArray(Class<?> _class)
_class
- - Class>
public static boolean isArray(Method method)
method
- the method
public static String concateStrings(Object instance, String value)
instance
- the instancevalue
- the value
public static void clearAttributes(Object source, Class<? extends Annotation> attributeMarker)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |