Package yapion.utils
Class ReflectionsUtils
- java.lang.Object
- 
- yapion.utils.ReflectionsUtils
 
- 
 public class ReflectionsUtils extends java.lang.Object
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classReflectionsUtils.Parameter
 - 
Method SummaryModifier and Type Method Description static java.lang.ObjectaccessField(java.lang.reflect.Field f, java.lang.Object o)static java.lang.ObjectaccessField(java.lang.String s, java.lang.Object o)static java.lang.ObjectconstructObject(java.lang.String className, boolean data)Construct an Object instance from a given className.static java.lang.ObjectconstructObject(YAPIONObject yapionObject, InternalSerializer<?> internalSerializer, boolean data)Construct an Object instance from a given yapionObject.static java.lang.ObjectconstructObjectObjenesis(java.lang.Class<?> clazz)Construct an Object instance from a givenClass.static java.lang.ObjectconstructObjectObjenesis(java.lang.String className)Construct an Object instance from a given className.static voiddiscardCache()Discard the cache used bystatic java.lang.reflect.FieldgetField(java.lang.Class<?> clazz, java.lang.String name)static java.util.List<java.lang.reflect.Field>getFields(java.lang.Class<?> clazz)static java.lang.ObjectgetValueOfField(java.lang.reflect.Field field, java.lang.Object object)static intimplementsInterface(java.lang.Class<?> toCheck, java.lang.Class<?> interfaceClass)static intimplementsInterface(java.lang.String type, java.lang.Class<?> interfaceClass)static MethodReturnValue<java.lang.Object>invokeMethod(java.lang.String name, java.lang.Object object, java.lang.Object... parameters)Invokes a method with the given arguments on a given object and return the possible return value.static MethodReturnValue<java.lang.Object>invokeMethod(java.lang.String name, java.lang.Object object, ReflectionsUtils.Parameter... parameters)Invokes a method with the given arguments on a given object and return the possible return value.static MethodReturnValue<java.lang.Object>invokeMethodObjectSystem(java.lang.reflect.Method method, java.lang.Object object)Invokes a method with the given arguments on a given object and return the possible return value.static booleanisClassSuperclassOf(@NonNull java.lang.Class<?> toCheck, @NonNull java.lang.Class<?> superClass)static booleanisClassSuperclassOf(@NonNull java.lang.String toCheck, @NonNull java.lang.Class<?> superClass)static voidsetCacheSize(int cacheSize)Set the cache size of the internal cache to a specific number above 100.static booleansetValueOfField(java.lang.reflect.Field field, java.lang.Object object, java.lang.Object value)
 
- 
- 
- 
Method Detail- 
setCacheSizepublic static void setCacheSize(int cacheSize) Set the cache size of the internal cache to a specific number above 100. If you set a number below 100 it will default to 100.- Parameters:
- cacheSize- the cache Size
 
 - 
discardCachepublic static void discardCache() Discard the cache used by
 - 
invokeMethodpublic static MethodReturnValue<java.lang.Object> invokeMethod(java.lang.String name, java.lang.Object object, ReflectionsUtils.Parameter... parameters) Invokes a method with the given arguments on a given object and return the possible return value.- Parameters:
- name- the name of the method to be called
- object- the object on which the method should be called
- parameters- the parameters that should be used
- Returns:
- the possible return value
 
 - 
invokeMethodpublic static MethodReturnValue<java.lang.Object> invokeMethod(java.lang.String name, java.lang.Object object, java.lang.Object... parameters) Invokes a method with the given arguments on a given object and return the possible return value.- Parameters:
- name- the name of the method to be called
- object- the object on which the method should be called
- parameters- the parameters that should be used
- Returns:
- the possible return value
 
 - 
invokeMethodObjectSystempublic static MethodReturnValue<java.lang.Object> invokeMethodObjectSystem(java.lang.reflect.Method method, java.lang.Object object) Invokes a method with the given arguments on a given object and return the possible return value.- Parameters:
- method- the method to be called
- object- the object on which the method should be called
- Returns:
- the possible return value
 
 - 
constructObjectObjenesispublic static java.lang.Object constructObjectObjenesis(java.lang.String className) Construct an Object instance from a given className. By using theObjenesisBase.- Parameters:
- className- the class to create an instance from
- Returns:
- an instance of the specified class
 
 - 
constructObjectObjenesispublic static java.lang.Object constructObjectObjenesis(java.lang.Class<?> clazz) Construct an Object instance from a givenClass. By using theObjenesisBase.- Parameters:
- clazz- the class to create an instance from
- Returns:
- an instance of the specified class
 
 - 
constructObjectpublic static java.lang.Object constructObject(java.lang.String className, boolean data)Construct an Object instance from a given className. By using theObjenesisBase, only withYAPIONDataorYAPIONObjenesisor a NoArgument constructor.- Parameters:
- className- the class to create an instance from
- data- branch to- constructObjectObjenesis(String)
- Returns:
- an instance of the specified class
 
 - 
constructObjectpublic static java.lang.Object constructObject(YAPIONObject yapionObject, InternalSerializer<?> internalSerializer, boolean data) Construct an Object instance from a given yapionObject. By using theObjenesisBase, only withYAPIONDataorYAPIONObjenesisor a NoArgument constructor.- Parameters:
- yapionObject- the class to create an instance from
- internalSerializer- the internalSerializer using it
- data- branch to- constructObjectObjenesis(String)
- Returns:
- an instance of the specified class
 
 - 
accessFieldpublic static java.lang.Object accessField(java.lang.String s, java.lang.Object o)
 - 
accessFieldpublic static java.lang.Object accessField(java.lang.reflect.Field f, java.lang.Object o)
 - 
isClassSuperclassOfpublic static boolean isClassSuperclassOf(@NonNull @NonNull java.lang.String toCheck, @NonNull @NonNull java.lang.Class<?> superClass)
 - 
isClassSuperclassOfpublic static boolean isClassSuperclassOf(@NonNull @NonNull java.lang.Class<?> toCheck, @NonNull @NonNull java.lang.Class<?> superClass)
 - 
implementsInterfacepublic static int implementsInterface(java.lang.String type, java.lang.Class<?> interfaceClass)
 - 
implementsInterfacepublic static int implementsInterface(java.lang.Class<?> toCheck, java.lang.Class<?> interfaceClass)
 - 
getFieldspublic static java.util.List<java.lang.reflect.Field> getFields(java.lang.Class<?> clazz) 
 - 
getValueOfFieldpublic static java.lang.Object getValueOfField(java.lang.reflect.Field field, java.lang.Object object)
 - 
setValueOfFieldpublic static boolean setValueOfField(java.lang.reflect.Field field, java.lang.Object object, java.lang.Object value)
 - 
getFieldpublic static java.lang.reflect.Field getField(java.lang.Class<?> clazz, java.lang.String name)
 
- 
 
-