java.lang.Object
com.github.hypfvieh.util.ReflectionUtil
Utility methods which uses reflection techniques.
- Seit:
- v1.0.1 - 2018-02-12
- Autor:
- David Michaelis (David.Michaelis@baaderbank.de)
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic enumEnum which defines which information is retrieved by reflection. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic <T> TcreateInstance(Class<T> _clz) Tries to create a new instance of the given class type using reflection.getAllDeclaredFields(Class<?> _class, String... _fieldsToIgnore) Extract allFields found in the given class recursively.getAllDeclaredFieldsAnnotatedWithAny(Class<?> _class, Class<? extends Annotation>... _annotations) Extract allFields with any of the given annotations found in the given class recursively.getAllDeclaredFieldsNotAnnotatedWithAny(Class<?> _class, Class<? extends Annotation>... _annotations) Extract allFields without any of the given annotations found in the given class recursively.getAllDeclaredMethods(Class<?> _class, String... _methodsToIgnore) Extract allMethods found in the given class recursively.getAllDeclaredMethodsAnnotatedWithAny(Class<?> _class, Class<? extends Annotation>... _annotations) Extract allMethods with any of the given annotations found in the given class recursively.getAllDeclaredMethodsNotAnnotatedWithAny(Class<?> _class, Class<? extends Annotation>... _annotations) Extract allMethods without any of the given annotations found in the given class recursively.getAllDeclaredNonStaticFields(Class<?> _class, String... _fieldsToIgnore) Extract allFields which are not static and do not match any of the given ignore names.getAllDeclaredNonStaticMethods(Class<?> _class, String... _methodNamesToIgnore) Extract allMethods which are not static and do not match any of the given ignore names.getAllDeclaredStaticFields(Class<?> _class, String... _fieldsToIgnore) Extract allFields which are static and do not match any of the given ignore names.getAllDeclaredStaticMethods(Class<?> _class, String... _methodNamesToIgnore) Extract allMethods which are static and do not match any of the given ignore names.
-
Methodendetails
-
getAllDeclaredFields
Extract allFields found in the given class recursively. This means, allFields are retrieved, even fields which only exists in superclasses.
NOTE: Accessibility ofFields returned in theSethave not been changed (setAccessable(true) is NOT called explicitly)!- Parameter:
_class- class to analyze_fieldsToIgnore- fields to skip- Gibt zurück:
- null if _class was null, Set otherwise
-
getAllDeclaredStaticFields
Extract allFields which are static and do not match any of the given ignore names.- Parameter:
_class- class to analyze_fieldsToIgnore- fields to skip- Gibt zurück:
- null if _class was null, Set otherwise
-
getAllDeclaredNonStaticFields
Extract allFields which are not static and do not match any of the given ignore names.- Parameter:
_class- class to analyze_fieldsToIgnore- fields to skip- Gibt zurück:
- null if _class was null, Set otherwise
-
getAllDeclaredFieldsAnnotatedWithAny
@SafeVarargs public static Set<Field> getAllDeclaredFieldsAnnotatedWithAny(Class<?> _class, Class<? extends Annotation>... _annotations) Extract allFields with any of the given annotations found in the given class recursively. This means, allFields are retrieved, even fields which only exists in superclasses.
NOTE: Accessibility ofFields returned in theSethave not been changed (setAccessable(true) is NOT called explicitly)!- Parameter:
_class- class to analyze_annotations- annotations to check for- Gibt zurück:
- null if _class was null, Set otherwise
-
getAllDeclaredFieldsNotAnnotatedWithAny
@SafeVarargs public static Set<Field> getAllDeclaredFieldsNotAnnotatedWithAny(Class<?> _class, Class<? extends Annotation>... _annotations) Extract allFields without any of the given annotations found in the given class recursively. This means, allFields are retrieved, even fields which only exists in superclasses.
NOTE: Accessibility ofFields returned in theSethave not been changed (setAccessable(true) is NOT called explicitly)!- Parameter:
_class- class to analyze_annotations- annotations to check for- Gibt zurück:
- null if _class was null, Set otherwise
-
getAllDeclaredMethods
Extract allMethods found in the given class recursively. This means, allMethods are retrieved, even methods which only exists in superclasses.
NOTE: Accessibility ofMethods returned in theSethave not been changed (setAccessable(true) is NOT called explicitly)!- Parameter:
_class- class to analyze_methodsToIgnore- methods to skip- Gibt zurück:
- null if _class was null, Set otherwise
- Seit:
- v1.0.2 - 2018-04-20
-
getAllDeclaredStaticMethods
public static Set<Method> getAllDeclaredStaticMethods(Class<?> _class, String... _methodNamesToIgnore) Extract allMethods which are static and do not match any of the given ignore names.- Parameter:
_class- class to analyze_methodNamesToIgnore- methods to skip- Gibt zurück:
- null if _class was null, Set otherwise
- Seit:
- v1.0.2 - 2018-04-20
-
getAllDeclaredNonStaticMethods
public static Set<Method> getAllDeclaredNonStaticMethods(Class<?> _class, String... _methodNamesToIgnore) Extract allMethods which are not static and do not match any of the given ignore names.- Parameter:
_class- class to analyze_methodNamesToIgnore- methods to skip- Gibt zurück:
- null if _class was null, Set otherwise
- Seit:
- v1.0.2 - 2018-04-20
-
getAllDeclaredMethodsAnnotatedWithAny
@SafeVarargs public static Set<Method> getAllDeclaredMethodsAnnotatedWithAny(Class<?> _class, Class<? extends Annotation>... _annotations) Extract allMethods with any of the given annotations found in the given class recursively. This means, allMethods are retrieved, even fields which only exists in superclasses.
NOTE: Accessibility ofMethods returned in theSethave not been changed (setAccessable(true) is NOT called explicitly)!- Parameter:
_class- class to analyze_annotations- annotations to check for- Gibt zurück:
- null if _class was null, Set otherwise
- Seit:
- v1.0.2 - 2018-04-20
-
getAllDeclaredMethodsNotAnnotatedWithAny
@SafeVarargs public static Set<Method> getAllDeclaredMethodsNotAnnotatedWithAny(Class<?> _class, Class<? extends Annotation>... _annotations) Extract allMethods without any of the given annotations found in the given class recursively. This means, allMethods are retrieved, even fields which only exists in superclasses.
NOTE: Accessibility ofMethods returned in theSethave not been changed (setAccessable(true) is NOT called explicitly)!- Parameter:
_class- class to analyze_annotations- annotations to check for- Gibt zurück:
- null if _class was null, Set otherwise
- Seit:
- v1.0.2 - 2018-04-20
-
createInstance
Tries to create a new instance of the given class type using reflection.It is assumed that there is a visible (public) no argument constructor. If instantiation fails,
nullis returned (exceptions are ignored).- Typparameter:
T- type- Parameter:
_clz- class to instantiate- Gibt zurück:
- new instance or null
- Seit:
- v1.2.1 - 2023-01-10
-