B - The bean typeT - The bean property type@Immutable public interface BeanProperty<B,T> extends AnnotatedElement, AnnotationMetadataDelegate
A BeanProperty allows you to read the value of a property via get(Object) or write to it via set(Object, Object), without using reflection.
The annotations of a property can be inspected via the AnnotationMetadataProvider.getAnnotationMetadata() method.
BeanIntrospectionCLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBEREMPTY| Modifier and Type | Method and Description |
|---|---|
default Argument<T> |
asArgument()
Represent the type as an argument, including any generic type information.
|
default void |
convertAndSet(B bean,
java.lang.Object value)
Convert the value and set if on the bean using the default conversion service.
|
T |
get(B bean)
Read the bean value.
|
default <T2> java.util.Optional<T2> |
get(B bean,
Argument<T2> argument)
Read the value and try to convert it to the given type.
|
default <T2> java.util.Optional<T2> |
get(B bean,
ArgumentConversionContext<T2> conversionContext)
Read the value and try to convert it to the given type.
|
default <T2> java.util.Optional<T2> |
get(B bean,
java.lang.Class<T2> type)
Read the value and try to convert it to the given type.
|
default <T2> T2 |
get(B bean,
java.lang.Class<T2> type,
T2 defaultValue)
Read the value and try to convert it to the given type.
|
BeanIntrospection<B> |
getDeclaringBean() |
default java.lang.Class<B> |
getDeclaringType()
The declaring type of the property.
|
java.lang.Class<T> |
getType() |
default boolean |
isReadOnly() |
default boolean |
isReadWrite()
Whether the property can be written to and read from.
|
default boolean |
isWriteOnly() |
default void |
set(B bean,
T value)
Write the bean value.
|
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullablebooleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, doubleValue, doubleValue, doubleValue, enumValue, enumValue, enumValue, enumValue, enumValues, enumValues, enumValues, enumValues, findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByType, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, getValues, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, hasStereotype, intValue, intValue, intValue, isAnnotationPresent, isDeclaredAnnotationPresent, isEmpty, isFalse, isFalse, isPresent, isPresent, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByTypegetAnnotationMetadata@NonNull BeanIntrospection<B> getDeclaringBean()
@Nullable T get(@NonNull B bean)
bean - The bean to read fromjava.lang.IllegalArgumentException - If the bean instance if not of the correct type@NonNull
default <T2> java.util.Optional<T2> get(@NonNull
B bean,
@NonNull
java.lang.Class<T2> type)
T2 - The generic typebean - The beantype - The typedefault <T2> java.util.Optional<T2> get(@NonNull
B bean,
@NonNull
Argument<T2> argument)
T2 - The generic typebean - The beanargument - The typedefault <T2> java.util.Optional<T2> get(@NonNull
B bean,
@NonNull
ArgumentConversionContext<T2> conversionContext)
T2 - The generic typebean - The beanconversionContext - The conversion context to use@Nullable
default <T2> T2 get(@NonNull
B bean,
@NonNull
java.lang.Class<T2> type,
@Nullable
T2 defaultValue)
T2 - The generic typebean - The beantype - The typedefaultValue - The default value if conversion is not possibledefault void set(@NonNull
B bean,
@Nullable
T value)
bean - The beanvalue - The value to writejava.lang.IllegalArgumentException - If either the bean type or value type are not correctdefault void convertAndSet(@NonNull
B bean,
@Nullable
java.lang.Object value)
bean - The beanvalue - The valueConversionErrorException - If the value couldn't be converted@NonNull java.lang.Class<T> getType()
default Argument<T> asArgument()
default boolean isReadOnly()
default boolean isWriteOnly()
default boolean isReadWrite()
default java.lang.Class<B> getDeclaringType()