T - Bean class to which this property set referspublic interface BeanPropertySet<T> extends PropertySet<PathProperty<?>>
PropertySet collecting and providing Java Bean property set and configuration as PathProperty
property type elements.BeanIntrospectorPropertySet.Builder<P extends Property>CONTEXT_KEY| Modifier and Type | Method and Description |
|---|---|
static <T> BeanPropertySet<T> |
create(Class<? extends T> beanClass)
Create a bean property set using default
BeanIntrospector. |
static <T> BeanPropertySet<T> |
create(Class<? extends T> beanClass,
Path<?> parentPath)
Create a bean property set using default
BeanIntrospector. |
Class<? extends T> |
getBeanClass()
Get the bean class to which this property set refers.
|
<PT> Optional<PathProperty<PT>> |
getProperty(String propertyName)
Get the bean property with given
propertyName. |
<PT> Optional<PathProperty<PT>> |
getProperty(String propertyName,
Class<PT> type)
Get the bean property with given
propertyName and given type. |
<V> V |
read(Path<V> path,
T instance)
Read the value of the property bound to given
path from given bean instance, using full path name to
match the bean property to read. |
default PropertyBox |
read(PropertyBox propertyBox,
T instance)
Read the property values from given bean instance into the given
PropertyBox, using given
propertyBox property set. |
PropertyBox |
read(PropertyBox propertyBox,
T instance,
boolean ignoreMissing)
Read the property values from given bean instance into the given
PropertyBox, using given
propertyBox property set. |
<V> V |
read(String propertyName,
T instance)
Read the value of the property with given
propertyName from given bean instance. |
default PropertyBox |
read(T instance)
Read the property values from given bean instance into a
PropertyBox with this property set. |
default <PT> PathProperty<PT> |
requireProperty(String propertyName)
Get the bean property with given
propertyName. |
default <PT> PathProperty<PT> |
requireProperty(String propertyName,
Class<PT> type)
Get the bean property with given
propertyName and given type. |
<P> void |
write(Path<P> path,
P value,
T instance)
Write the
value bound to given path to given bean instance, using full path name to
match the bean property to write. |
default T |
write(PropertyBox propertyBox,
T instance)
Write the property values contained into given
PropertyBox into given bean instance. |
T |
write(PropertyBox propertyBox,
T instance,
boolean ignoreMissing)
Write the property values contained into given
PropertyBox into given bean instance. |
void |
write(String propertyName,
Object value,
T instance)
Write the
value of the property with given propertyName to given bean instance. |
asList, builder, contains, execute, join, of, of, of, size, streamforEach, iterator, spliteratorClass<? extends T> getBeanClass()
<PT> Optional<PathProperty<PT>> getProperty(String propertyName)
propertyName. For nested properties, the default property name
hierarchy notation using Path.PATH_HIERARCHY_SEPARATOR as separator character is used.PT - Property typepropertyName - Property name (not null)<PT> Optional<PathProperty<PT>> getProperty(String propertyName, Class<PT> type)
propertyName and given type. For nested properties,
the default property name hierarchy notation using Path.PATH_HIERARCHY_SEPARATOR as separator character
is used.PT - Property typepropertyName - Property name (not null)type - Property typeTypeMismatchException - If the given type is not consistent with actual property typedefault <PT> PathProperty<PT> requireProperty(String propertyName)
propertyName. For nested properties, the default property name
hierarchy notation using Path.PATH_HIERARCHY_SEPARATOR as separator character is used.PT - Property typepropertyName - Property name (not null)Property.PropertyNotFoundException - If property with given name was not found in bean property setdefault <PT> PathProperty<PT> requireProperty(String propertyName, Class<PT> type)
propertyName and given type. For nested properties,
the default property name hierarchy notation using Path.PATH_HIERARCHY_SEPARATOR as separator character
is used.PT - Property typepropertyName - Property name (not null)type - Property typeProperty.PropertyNotFoundException - If property with given name was not found in bean property setTypeMismatchException - If the given type is not consistent with actual property type<V> V read(String propertyName, T instance)
propertyName from given bean instance.V - Property and result typepropertyName - Name of the property to read (not null)instance - Bean instance from which to read the property value (not null)Property.PropertyNotFoundException - If a property with given name is not found in this property setProperty.PropertyAccessException - Error accessing bean propertiesTypeMismatchException - If actual property type and expected type mismatch<V> V read(Path<V> path, T instance)
path from given bean instance, using full path name to
match the bean property to read.V - Path and value typepath - Property path to read (not null)instance - Bean instance from which to read the property value (not null)Property.PropertyNotFoundException - If a property wich corresponds to given path name is not found in this property
setProperty.PropertyAccessException - Error accessing bean propertiesTypeMismatchException - If actual property type and expected type mismatchvoid write(String propertyName, Object value, T instance)
value of the property with given propertyName to given bean instance.propertyName - Name of the property to write (not null)value - Value to write (may be null)instance - Bean instance to which to write the property valueProperty.PropertyNotFoundException - If a property with given name is not found in this property setProperty.PropertyAccessException - Error accessing bean propertiesTypeMismatchException - If actual property type and expected type mismatch<P> void write(Path<P> path, P value, T instance)
value bound to given path to given bean instance, using full path name to
match the bean property to write.P - Path and value typepath - Property path to write (not null)value - Value to write (may be null)instance - Bean instance to which to write the property valueProperty.PropertyNotFoundException - If a property wich corresponds to given path name is not found in this property
setProperty.PropertyAccessException - Error accessing bean propertiesTypeMismatchException - If actual property type and expected type mismatchPropertyBox read(PropertyBox propertyBox, T instance, boolean ignoreMissing)
PropertyBox, using given
propertyBox property set.
The matching between the PropertyBox properties and the bean properties is performed by property name, so only
the PropertyBox properties which implements Path will be taken into account, using Path.getName()
as property name.
Any PropertyValueConverter will be applied to read values from bean data model.
propertyBox - PropertyBox into which to write the property values (not null)instance - Bean instance from which read the property values (not null)ignoreMissing - true to ignore properties of the PropertyBox property set which are not present
as bean property. If false, when a property of the PropertyBox property set does not match
with any of the bean properties, a Property.PropertyNotFoundException is thrown.Property.PropertyNotFoundException - If ignoreMissing is false and a property of the
PropertyBox property set does not match with any of the bean propertiesProperty.PropertyAccessException - Error accessing bean propertiesTypeMismatchException - If the bean property type and the PropertyBox property type mismatch for a propertyValidator.ValidationException - If not PropertyBox.isInvalidAllowed() for given property box and one of the
property values validation faileddefault PropertyBox read(PropertyBox propertyBox, T instance)
PropertyBox, using given
propertyBox property set.
The matching between the PropertyBox properties and the bean properties is performed by property name, so only
the PropertyBox properties which implements Path will be taken into account, using Path.getName()
as property name.
Any PropertyValueConverter will be applied to read values from bean data model.
propertyBox - PropertyBox into which to write the property values (not null)instance - Bean instance from which read the property values (not null)Property.PropertyNotFoundException - If a property of the PropertyBox property set does not match with any of the
bean propertiesProperty.PropertyAccessException - Error accessing bean propertiesTypeMismatchException - If the bean property type and the PropertyBox property type mismatch for a propertyValidator.ValidationException - If not PropertyBox.isInvalidAllowed() for given property box and one of the
property values validation faileddefault PropertyBox read(T instance)
PropertyBox with this property set.
By default, the created PropertyBox allows invalid values, so no property value validation is performed.
Any PropertyValueConverter will be applied to read values from bean data model.
instance - Bean instance from which read the property values (not null)Property.PropertyAccessException - Error accessing bean propertiesT write(PropertyBox propertyBox, T instance, boolean ignoreMissing)
PropertyBox into given bean instance.
The matching between the PropertyBox properties and the bean properties is performed by property name, so only
the PropertyBox properties which implements PathProperty will be taken into account, using
Path.getName() as property name.
Any PropertyValueConverter will be applied to write values to bean data model.
propertyBox - PropertyBox from which read the property values (not null)instance - Bean instance to which to write the property values (not null)ignoreMissing - true to ignore properties of the PropertyBox property set which are not present
as bean property. If false, when a property of the PropertyBox property set does not match
with any of the bean properties, a Property.PropertyNotFoundException is thrown.Property.PropertyNotFoundException - If ignoreMissing is false and a property of the
PropertyBox property set does not match with any of the bean propertiesProperty.PropertyAccessException - Error accessing bean propertiesTypeMismatchException - If the bean property type and the PropertyBox property type mismatch for a propertydefault T write(PropertyBox propertyBox, T instance)
PropertyBox into given bean instance.
The matching between the PropertyBox properties and the bean properties is performed by property name, so only
the PropertyBox properties which implements PathProperty will be taken into account, using
Path.getName() as property name.
Any PropertyValueConverter will be applied to write values to bean data model.
propertyBox - PropertyBox from which read the property values (not null)instance - Bean instance to which to write the property values (not null)Property.PropertyNotFoundException - If a property of the PropertyBox property set does not match with any of the
bean propertiesProperty.PropertyAccessException - Error accessing bean propertiesTypeMismatchException - If the bean property type and the PropertyBox property type mismatch for a propertystatic <T> BeanPropertySet<T> create(Class<? extends T> beanClass)
BeanIntrospector.T - Bean typebeanClass - Bean class for which to create the property set (not null)PropertySet of the properties detected from given bean classstatic <T> BeanPropertySet<T> create(Class<? extends T> beanClass, Path<?> parentPath)
BeanIntrospector. If a parentPath is specified, it
will be setted as bean root properties parent path.T - Bean typebeanClass - Bean class for which to create the property set (not null)parentPath - Optional parent path to set as bean root properties parent pathPropertySet of the properties detected from given bean classCopyright © 2017 The Holon Platform. All rights reserved.