public final class ReflectUtil extends Object
Constructor and Description |
---|
ReflectUtil() |
Modifier and Type | Method and Description |
---|---|
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.
|
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 classRuntimeException
- if classType is undefinedpublic static Object createGenericInstance(Class clazz) throws InstantiationException, IllegalAccessException
clazz
- the classInstantiationException
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 typeIllegalAccessException
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 methodNoSuchMethodException
IllegalAccessException
InvocationTargetException
InstantiationException
public static boolean isArray(Class<?> _class)
_class
- - Class>public static boolean isArray(Method method)
method
- the methodpublic static String concateStrings(Object instance, String value)
instance
- the instancevalue
- the valuepublic static void clearAttributes(Object source, Class<? extends Annotation> attributeMarker)
Copyright © 2000–2022 EPAM Systems. All rights reserved.