Klasse ReflectionUtils

java.lang.Object
ch.framedev.simplejavautils.ReflectionUtils

public class ReflectionUtils extends Object
/ This Plugin was Created by FrameDev / Package: de.framedev.javautils / ClassName ReflectionUtils / Date: 26.09.21 / Project: JavaUtils / Copyrighted by FrameDev

This Class can be used for Reflection in Java Please mention the use of this Class ReflectionUtils

  • Konstruktordetails

    • ReflectionUtils

      public ReflectionUtils()
      This Class can be used for Java Reflection Please mention the use of this Class ReflectionUtils
    • ReflectionUtils

      public ReflectionUtils(boolean accessible)
      This Class can be used for Java Reflection Please mention the use of this Class ReflectionUtils
  • Methodendetails

    • getClassName

      public String getClassName(Class<?> class_)
      Return the ClassName
      Parameter:
      class_ - the Class
      Gibt zurück:
      return the ClassName (Package and Name as example [de.framedev.javaproject.main.Main])
    • getEnumValue

      public Object getEnumValue(String className, String of)
      Return the ClassName
      Parameter:
      of - the Object
      Gibt zurück:
      return the ClassName (Package and Name as example [de.framedev.javaproject.main.Main])
    • getEnumValues

      public Object[] getEnumValues(String className)
      Return the Enume Values
      Parameter:
      className - the Class Name
      Gibt zurück:
      return the Enum Values
    • getField

      public Field getField(String className, String fieldName)
      Retrieves you the selected Field
      Parameter:
      className - the Class Name
      fieldName - the Field Name
      Gibt zurück:
      return the Field
    • getFieldSuperClass

      public Field getFieldSuperClass(String className, String fieldName)
      Retrieves you the selected Field from the Upper Class
      Parameter:
      className - the Class Name
      fieldName - the Field Name
      Gibt zurück:
      return the Field
    • hasConstructorAnnotation

      public boolean hasConstructorAnnotation(Constructor<?> constructor, Class<? extends Annotation> class__)
      Retrieves if the Constructor has the Annotation
      Parameter:
      constructor - the Constructor
      class__ - the Annotation
      Gibt zurück:
      return true if the Constructor has the Annotation
    • hasClassAnnotation

      public boolean hasClassAnnotation(String className, Class<? extends Annotation> class__)
      Retrieves if the Class has the Annotation
      Parameter:
      className - the ClassName
      class__ - the Annotation
      Gibt zurück:
      return true if the Class has the Annotation
    • hasClassAnnotationSuperClass

      public boolean hasClassAnnotationSuperClass(String className, Class<? extends Annotation> class__)
      Retrieves if the Class has the Annotation from the Upper Class
      Parameter:
      className - the ClassName
      class__ - the Annotation
      Gibt zurück:
      return true if the Class has the Annotation
    • hasFieldAnnotation

      public boolean hasFieldAnnotation(String className, String fieldName, Class<? extends Annotation> class__)
      Retrieves if the Field has the Annotation
      Parameter:
      className - the ClassName
      fieldName - the Field Name
      class__ - the Annotation
      Gibt zurück:
      return true if the Field has the Annotation
    • hasFieldAnnotationSuperClass

      public boolean hasFieldAnnotationSuperClass(String className, String fieldName, Class<? extends Annotation> class__)
      Retrieves if the Field has the Annotation from the Upper Class
      Parameter:
      className - the ClassName
      fieldName - the Field Name
      class__ - the Annotation
      Gibt zurück:
      return true if the Field has the Annotation
    • getFieldAnnotations

      public Annotation[] getFieldAnnotations(String className, String fieldName)
      Retrieves the Annotations from the Field
      Parameter:
      className - the ClassName
      fieldName - the Field Name
      Gibt zurück:
      return the Annotations from the Field
    • getFieldAnnotationsSuperClass

      public Annotation[] getFieldAnnotationsSuperClass(String className, String fieldName)
      Retrieves the Annotations from the Field from the Upper Class
      Parameter:
      className - the ClassName
      fieldName - the Field Name
      Gibt zurück:
      return the Annotations from the Field
    • getMethodAnnotations

      public Annotation[] getMethodAnnotations(String className, String methodName)
      Retrieves the Method Annotations
      Parameter:
      className - the ClassName
      methodName - the Method Name
      Gibt zurück:
      return the Method Annotations
    • getMethodAnnotationsSuperClass

      public Annotation[] getMethodAnnotationsSuperClass(String className, String methodName)
      Retrieves the Method Annotations from the Upper Class
      Parameter:
      className - the ClassName
      methodName - the Method Name
      Gibt zurück:
      return the Method Annotations
    • hasAnnotation

      public boolean hasAnnotation(String className, String methodName, Class<? extends Annotation> class__)
      Retrieves the Method Annotations
      Parameter:
      className - the ClassName
      methodName - the Method Name
      class__ - the Annotation
      Gibt zurück:
      return the Method Annotations
    • hasAnnotationSuperClass

      public boolean hasAnnotationSuperClass(String className, String methodName, Class<? extends Annotation> class__)
      Retrieves the Method Annotations from the Upper Class
      Parameter:
      className - the ClassName
      methodName - the Method Name
      class__ - the Annotation
      Gibt zurück:
      return the Method Annotations
    • getMethod

      public Method getMethod(String className, String methodName)
      Retrieves the Method
      Parameter:
      className - the ClassName
      methodName - the Field Name
      Gibt zurück:
      return the Method
    • getMethodSuperClass

      public Method getMethodSuperClass(String className, String methodName)
      Retrieves the Method from the Upper Class
      Parameter:
      className - the ClassName
      methodName - the Field Name
      Gibt zurück:
      return the Method
    • getParameterTypes

      public List<Type> getParameterTypes(String className, String methodName)
      Retrieves the Method Parameter Types
      Parameter:
      className - the ClassName
      methodName - the Field Name
      Gibt zurück:
      return the Method Parameter Types
    • getParameterTypesSuperClass

      public List<Type> getParameterTypesSuperClass(String className, String methodName)
      Retrieves the Method Parameter Types from the Upper Class
      Parameter:
      className - the ClassName
      methodName - the Field Name
      Gibt zurück:
      return the Method Parameter Types
    • runMethod

      public Object runMethod(String className, Object object, String methodName, Object... args)
      Invokes the Method with arguments
      Parameter:
      className - the fully qualified name of the class containing the method
      object - the instance of the class on which to invoke the method
      methodName - the name of the method to invoke
      args - the arguments to pass to the method
      Gibt zurück:
      the result of the method invocation, or null if an error occurs
    • runMethodSupClass

      public Object runMethodSupClass(String className, Object object, String methodName, Object... args)
      Invokes the Method with arguments
      Parameter:
      className - the fully qualified name of the class containing the method
      object - the instance of the class on which to invoke the method
      methodName - the name of the method to invoke
      args - the arguments to pass to the method
      Gibt zurück:
      the result of the method invocation, or null if an error occurs
    • runMethod

      public Object runMethod(String className, Object object, String methodName)
      Invokes the Method
      Parameter:
      className - the fully qualified name of the class containing the method
      object - the instance of the class on which to invoke the method
      methodName - the name of the method to invoke
      Gibt zurück:
      the result of the method invocation, or null if an error occurs
    • runMethodSuperClass

      public Object runMethodSuperClass(String className, Object object, String methodName)
      Invokes the Method
      Parameter:
      className - the fully qualified name of the class containing the method
      object - the instance of the class on which to invoke the method
      methodName - the name of the method to invoke
      Gibt zurück:
      the result of the method invocation, or null if an error occurs
    • isVoidMethod

      public boolean isVoidMethod(String className, Object object, String methodName)
      Checks if the Method is a Void Method
      Parameter:
      className -
      object -
      methodName -
      Gibt zurück:
    • isVoidMethodSuperClass

      public boolean isVoidMethodSuperClass(String className, Object object, String methodName)
    • isVoidMethod

      public boolean isVoidMethod(String className, Object object, String methodName, Object... args)
    • isVoidMethodSuperClass

      public boolean isVoidMethodSuperClass(String className, Object object, String methodName, Object... args)
    • hasMethodArguments

      public boolean hasMethodArguments(String className, String methodName)
      Checks if the Method requires Arguments
      Parameter:
      className - the ClassName as example [de.framedev.javaproject.main.Main]
      methodName - the Method name to check
      Gibt zurück:
      return true if the Method requires Arguments
    • hasMethodArgumentsSuperClass

      public boolean hasMethodArgumentsSuperClass(String className, String methodName)
      Checks if the Method requires Arguments from the Upper Class
      Parameter:
      className - the ClassName as example [de.framedev.javaproject.main.Main]
      methodName - the Method name to check
      Gibt zurück:
      return true if the Method requires Arguments
    • setField

      public void setField(String className, Object object, String fieldName, Object data)
      Change the Value of a Field in a Class
      Parameter:
      className - the selected Class to change a Field
      object - the Class Object for the Field
      fieldName - the FieldName to change the value
      data - the new Value for the Field
    • setFieldSuperClass

      public void setFieldSuperClass(String className, Object object, String fieldName, Object data)
      Change the Value of a Field in a Class from the Upper Class
      Parameter:
      className - the selected Class to change a Field
      object - the Class Object for the Field
      fieldName - the FieldName to change the value
      data - the new Value for the Field
    • getFieldValue

      public Object getFieldValue(String className, Object object, String fieldName)
      Retrieves the Value of a Field in a Class
      Parameter:
      className - the selected Class to get a Field as example [de.framedev.javaproject.main.Main]
      object - the Class Object for the Field
      fieldName - the FieldName to get the value
      Gibt zurück:
      return the Value of the Field
    • getFieldValueSuperClass

      public Object getFieldValueSuperClass(String className, Object object, String fieldName)
      Retrieves the Value of a Field in a Class from the Upper Class
      Parameter:
      className - the selected Class to get a Field as example [de.framedev.javaproject.main.Main]
      object - the Class Object for the Field
      fieldName - the FieldName to get the value
      Gibt zurück:
      return the Value of the Field
    • getFieldType

      public Type getFieldType(String className, String fieldName)
      Retrieves the Type of the Field
      Parameter:
      className - the selected Class as example [de.framedev.javaproject.main.Main]
      fieldName - the selected Field name to get the Type from it
      Gibt zurück:
      return the Type of the Field
    • getFieldTypeSuperClass

      public Type getFieldTypeSuperClass(String className, String fieldName)
      Retrieves the Type of the Field from the Upper Class
      Parameter:
      className - the selected Class as example [de.framedev.javaproject.main.Main]
      fieldName - the selected Field name to get the Type from it
      Gibt zurück:
      return the Type of the Field
    • newInstance

      public Object newInstance(String className, List<Object> paramsObjects, boolean accessible, Class<?>... params)
      Create a new Instance from a Class
      Parameter:
      className - the selected Class Name as example [de.framedev.javaproject.main.Main]
      paramsObjects - the Parameters for the Constructor
      accessible - the Accessible for the Constructor
      params - the Parameters for the Constructor
      Gibt zurück:
      return the new Instance from the Class
    • newInstance

      public Object newInstance(String className, List<Object> paramsObjects, Class<?>... params)
      Create a new Instance from a Class
      Parameter:
      className - the selected Class Name as example [de.framedev.javaproject.main.Main]
      paramsObjects - the Parameters for the Constructor
      params - the Parameters for the Constructor
      Gibt zurück:
      return the new Instance from the Class
    • newInstance

      public Object newInstance(String className)
      Create a new Instance from a Class
      Parameter:
      className - the selected Class Name as example [de.framedev.javaproject.main.Main]
      Gibt zurück:
      return the new Instance from the Class
    • getConstructors

      public Constructor<?>[] getConstructors(String className)
      Retrieve the Constructorrs from the Class
      Parameter:
      className - the selected Class Name as example [de.framedev.javaproject.main.Main]
      Gibt zurück:
      return the Constructors from the Class
    • getConstructor

      public Constructor<?> getConstructor(String className, Class<?>... params)
      Retrieve the Constructor from the Class
      Parameter:
      className - the selected Class Name as example [de.framedev.javaproject.main.Main]
      params - the Parameters for the Constructor
      Gibt zurück:
      return the Constructor from the Class
    • getConstructor

      public Constructor<?> getConstructor(String className)
      Retrieve the Constructor from the Class
      Parameter:
      className - the selected Class Name as example [de.framedev.javaproject.main.Main]
      Gibt zurück:
      return the Constructor from the Class
    • getFields

      public Field[] getFields(String className)
      Retrieve the Fields from the Class
      Parameter:
      className - the selected Class Name as example [de.framedev.javaproject.main.Main]
      Gibt zurück:
      return the Fields from the Class
    • getFieldsSuperClass

      public Field[] getFieldsSuperClass(String className)
      Retrieve the Fields from the Upper Class
      Parameter:
      className - the selected Class Name as example [de.framedev.javaproject.main.Main]
      Gibt zurück:
      return the Fields from the Class