Interface BeanPropertyMember<B,T>
- Type Parameters:
B- The bean typeT- The member type
- All Superinterfaces:
AnnotationMetadataProvider, AnnotationSource, ArgumentCoercible<T>, Named
- All Known Subinterfaces:
ReflectiveIntrospection.ReflectivePropertyMember<B>
BeanProperty.
A BeanProperty merges the field, the read method and the write method of a property, and what the
super types declare on them, into a single element with a single merged
AnnotationMetadata. Some specifications, most notably Jakarta Bean
Validation, treat those members as distinct elements: a constraint declared on the field is validated against
the value the field holds, while a constraint declared on the getter is validated against the value the getter
returns, and the two can differ; a constraint an interface declares on its getter belongs to the implicit group
of that interface. A member is one declaration: the field, or the read or write method of one type of the
hierarchy, carrying the annotations that declaration carries and not the ones of the methods it overrides.
The members of a property are only available if the introspection was generated with
Introspected.members() set to true, otherwise
BeanProperty.getMembers() is empty.
- Since:
- 5.2.0
- Author:
- Denis Stepanov
- See Also:
-
Field Summary
Fields inherited from interface AnnotationSource
EMPTY -
Method Summary
Modifier and TypeMethodDescriptionThe type of the member as an argument, including any generic type information and type annotations.Class<?> The type that declares this member.The kind of the member, eitherElementType.FIELDorElementType.METHOD.getName()The name of the member.getType()booleanWhether the value of this member can be read withread(Object).@Nullable TRead the value held by this member.Methods inherited from interface AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getAnnotationMetadata, getTargetAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByTypeMethods inherited from interface AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclared
-
Method Details
-
getName
-
getElementType
ElementType getElementType()The kind of the member, eitherElementType.FIELDorElementType.METHOD.- Returns:
- The element type
-
getDeclaringType
Class<?> getDeclaringType()The type that declares this member. UnlikeBeanProperty.getDeclaringType()this is the type the member is actually declared on, which can be a supertype of the introspected bean type.- Returns:
- The declaring type
-
asArgument
The type of the member as an argument, including any generic type information and type annotations. For a field this is the field type, for a getter the return type and for a setter the type of the single parameter.- Specified by:
asArgumentin interfaceArgumentCoercible<B>- Returns:
- The argument
-
getType
-
isReadable
boolean isReadable()Whether the value of this member can be read withread(Object). Fields and getters are readable, setters are not.- Returns:
- True if the member can be read
-
read
Read the value held by this member. For a field this reads the field directly, bypassing any getter.- Parameters:
bean- The bean to read from- Returns:
- The value
- Throws:
UnsupportedOperationException- If the member is notreadableIllegalArgumentException- If the bean instance is not of the correct type
-