T
- The bean type.public interface BeanWrapper<T> extends AnnotationMetadataProvider
BeanIntrospection
.EMPTY
Modifier and Type | Method and Description |
---|---|
T |
getBean() |
default Collection<BeanProperty<T,Object>> |
getBeanProperties()
The properties.
|
BeanIntrospection<T> |
getIntrospection() |
default <P> Optional<P> |
getProperty(String name,
Argument<P> type)
Get the property of the given name and type.
|
default <P> Optional<P> |
getProperty(String name,
ArgumentConversionContext<P> context)
Get the property of the given name and type.
|
default <P> Optional<P> |
getProperty(String name,
Class<P> type)
Get the property of the given name and type.
|
default String[] |
getPropertyNames()
The property names.
|
default <P> P |
getRequiredProperty(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(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(String name,
Class<P> type)
Get the property value of the given type or throw an exception if it is unobtainable.
|
static <T2> BeanWrapper<T2> |
getWrapper(T2 bean)
Obtain a bean wrapper for the given bean.
|
default BeanWrapper<T> |
setProperty(String name,
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 default String[] getPropertyNames()
@Nonnull default Collection<BeanProperty<T,Object>> getBeanProperties()
@Nonnull default <P> P getRequiredProperty(@Nonnull String name, @Nonnull 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 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 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> Optional<P> getProperty(@Nonnull String name, @Nonnull Class<P> type)
P
- The required generic typename
- The nametype
- The required typedefault <P> Optional<P> getProperty(@Nonnull String name, Argument<P> type)
P
- The required generic typename
- The nametype
- The required typedefault <P> Optional<P> getProperty(@Nonnull String name, ArgumentConversionContext<P> context)
P
- The required generic typename
- The namecontext
- The conversion contextdefault BeanWrapper<T> setProperty(@Nonnull String name, @Nullable 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