T
- The bean type.public interface BeanWrapper<T> extends AnnotationMetadataProvider
BeanIntrospection
.EMPTY
Modifier and Type | Method and Description |
---|---|
static <T2> java.util.Optional<BeanWrapper<T2>> |
findWrapper(java.lang.Class<T2> type,
T2 bean)
Obtain a bean wrapper for the given bean.
|
static <T2> java.util.Optional<BeanWrapper<T2>> |
findWrapper(T2 bean)
Obtain a bean wrapper for the given bean.
|
T |
getBean() |
default java.util.Collection<BeanProperty<T,java.lang.Object>> |
getBeanProperties()
The properties.
|
BeanIntrospection<T> |
getIntrospection() |
default <P> java.util.Optional<P> |
getProperty(java.lang.String name,
Argument<P> type)
Get the property of the given name and type.
|
default <P> java.util.Optional<P> |
getProperty(java.lang.String name,
ArgumentConversionContext<P> context)
Get the property of the given name and type.
|
default <P> java.util.Optional<P> |
getProperty(java.lang.String name,
java.lang.Class<P> type)
Get the property of the given name and type.
|
default java.lang.String[] |
getPropertyNames()
The property names.
|
default <P> P |
getRequiredProperty(java.lang.String name,
Argument<P> argument)
Get the property value of the given type or throw an exception if it is unobtainable.
|
default <P> P |
getRequiredProperty(java.lang.String name,
ArgumentConversionContext<P> context)
Get the property value of the given type or throw an exception if it is unobtainable.
|
default <P> P |
getRequiredProperty(java.lang.String name,
java.lang.Class<P> type)
Get the property value of the given type or throw an exception if it is unobtainable.
|
static <T2> BeanWrapper<T2> |
getWrapper(java.lang.Class<T2> type,
T2 bean)
Obtain a bean wrapper for the given bean.
|
static <T2> BeanWrapper<T2> |
getWrapper(T2 bean)
Obtain a bean wrapper for the given bean.
|
default BeanWrapper<T> |
setProperty(java.lang.String name,
java.lang.Object value)
Sets a property of the given name to the given value.
|
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation
@NonNull BeanIntrospection<T> getIntrospection()
@NonNull T getBean()
@NonNull default java.lang.String[] getPropertyNames()
@NonNull default java.util.Collection<BeanProperty<T,java.lang.Object>> getBeanProperties()
@NonNull default <P> P getRequiredProperty(@NonNull java.lang.String name, @NonNull java.lang.Class<P> type)
P
- The property generic typename
- The nametype
- The typeIntrospectionException
- if no property existsConversionErrorException
- if the property cannot be converted to the given typedefault <P> P getRequiredProperty(@NonNull java.lang.String name, @NonNull Argument<P> argument)
P
- The property generic typename
- The nameargument
- The argument typeIntrospectionException
- if no property existsConversionErrorException
- if the property cannot be converted to the given type@NonNull default <P> P getRequiredProperty(@NonNull java.lang.String name, @NonNull ArgumentConversionContext<P> context)
P
- The property generic typename
- The namecontext
- The typeIntrospectionException
- if no property existsConversionErrorException
- if the property cannot be converted to the given type@NonNull default <P> java.util.Optional<P> getProperty(@NonNull java.lang.String name, @NonNull java.lang.Class<P> type)
P
- The required generic typename
- The nametype
- The required typedefault <P> java.util.Optional<P> getProperty(@NonNull java.lang.String name, Argument<P> type)
P
- The required generic typename
- The nametype
- The required typedefault <P> java.util.Optional<P> getProperty(@NonNull java.lang.String name, ArgumentConversionContext<P> context)
P
- The required generic typename
- The namecontext
- The conversion contextdefault BeanWrapper<T> setProperty(@NonNull java.lang.String name, @Nullable java.lang.Object value)
name
- The namevalue
- The valueConversionErrorException
- if the value cannot be converted to the underlying property type.@NonNull static <T2> BeanWrapper<T2> getWrapper(@NonNull T2 bean)
T2
- The bean typebean
- The beanIntrospectionException
- If the wrapper cannot be created@NonNull static <T2> java.util.Optional<BeanWrapper<T2>> findWrapper(@NonNull T2 bean)
T2
- The bean typebean
- The beanIntrospectionException
- If the wrapper cannot be created@NonNull static <T2> java.util.Optional<BeanWrapper<T2>> findWrapper(java.lang.Class<T2> type, @NonNull T2 bean)
T2
- The bean typetype
- the typebean
- The beanIntrospectionException
- If the wrapper cannot be created@NonNull static <T2> BeanWrapper<T2> getWrapper(java.lang.Class<T2> type, @NonNull T2 bean)
T2
- The bean typetype
- the typebean
- The beanIntrospectionException
- If the wrapper cannot be created