Class Introspection
- java.lang.Object
-
- org.assertj.core.util.introspection.Introspection
-
public final class Introspection extends java.lang.ObjectUtility methods related to JavaBeans Introspection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classIntrospection.MethodKey
-
Field Summary
Fields Modifier and Type Field Description private static booleanbareNamePropertyMethodsprivate static java.util.Map<Introspection.MethodKey,java.util.Optional<java.lang.reflect.Method>>METHOD_CACHE
-
Constructor Summary
Constructors Modifier Constructor Description privateIntrospection()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancanExtractBareNamePropertyMethods()private static java.lang.reflect.MethodfindGetter(java.lang.String propertyName, java.lang.Object target)private static java.lang.reflect.MethodfindMethod(java.lang.String name, java.lang.Object target)private static java.util.Optional<java.lang.reflect.Method>findMethodByKey(Introspection.MethodKey key)static java.lang.reflect.MethodgetPropertyGetter(java.lang.String propertyName, java.lang.Object target)Returns the getterMethodfor a property matching the given name in the given object.private static booleanisRecordInstance(java.lang.Object target)private static booleanisValidGetter(java.lang.reflect.Method method)private static java.lang.StringpropertyNotFoundErrorMessage(java.lang.String message, java.lang.String propertyName, java.lang.Object target)static voidsetExtractBareNamePropertyMethods(boolean bareNamePropertyMethods)
-
-
-
Field Detail
-
METHOD_CACHE
private static final java.util.Map<Introspection.MethodKey,java.util.Optional<java.lang.reflect.Method>> METHOD_CACHE
-
bareNamePropertyMethods
private static boolean bareNamePropertyMethods
-
-
Method Detail
-
getPropertyGetter
public static java.lang.reflect.Method getPropertyGetter(java.lang.String propertyName, java.lang.Object target)Returns the getterMethodfor a property matching the given name in the given object.- Parameters:
propertyName- the given property name.target- the given object.- Returns:
- the getter
Methodfor a property matching the given name in the given object. - Throws:
java.lang.NullPointerException- if the given property name isnull.java.lang.IllegalArgumentException- if the given property name is empty.java.lang.NullPointerException- if the given object isnull.IntrospectionError- if the getter for the matching property cannot be found or accessed.
-
setExtractBareNamePropertyMethods
public static void setExtractBareNamePropertyMethods(boolean bareNamePropertyMethods)
-
canExtractBareNamePropertyMethods
public static boolean canExtractBareNamePropertyMethods()
-
propertyNotFoundErrorMessage
private static java.lang.String propertyNotFoundErrorMessage(java.lang.String message, java.lang.String propertyName, java.lang.Object target)
-
findGetter
private static java.lang.reflect.Method findGetter(java.lang.String propertyName, java.lang.Object target)
-
isValidGetter
private static boolean isValidGetter(java.lang.reflect.Method method)
-
isRecordInstance
private static boolean isRecordInstance(java.lang.Object target)
-
findMethod
private static java.lang.reflect.Method findMethod(java.lang.String name, java.lang.Object target)
-
findMethodByKey
private static java.util.Optional<java.lang.reflect.Method> findMethodByKey(Introspection.MethodKey key)
-
-