public interface BeanIntrospector
| Modifier and Type | Interface and Description |
|---|---|
static class |
BeanIntrospector.BeanIntrospectionException
Exception thrown for bean introspection failures.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
CONTEXT_KEY
Default
Context resource key |
| Modifier and Type | Method and Description |
|---|---|
void |
addBeanPropertyPostProcessor(BeanPropertyPostProcessor beanPropertyPostProcessor)
Adds a
BeanPropertyPostProcessor to handle BeanProperty configuration during introspection. |
boolean |
clearCache()
If caching is enabled and supported, clear current introspection cache.
|
static BeanIntrospector |
get()
Gets the current
BeanIntrospector instance. |
static BeanIntrospector |
getDefault()
Return the default
BeanIntrospector using default ClassLoader. |
static BeanIntrospector |
getDefault(ClassLoader classLoader)
Return the default
BeanIntrospector using given classLoader. |
default <T> BeanPropertySet<T> |
getPropertySet(Class<? extends T> beanClass)
Introspect given Java Bean
beanClass and provides a BeanPropertySet to learn about bean
properties and configuration. |
<T> BeanPropertySet<T> |
getPropertySet(Class<? extends T> beanClass,
Path<?> parentPath)
Introspect given Java Bean
beanClass and provides a BeanPropertySet to learn about bean
properties and configuration. |
default <T> PropertyBox |
read(PropertyBox propertyBox,
T instance)
Read the property values from given bean instance into the given
PropertyBox, using given
propertyBox property set. |
default <T> 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. |
void |
removeBeanPropertyPostProcessor(BeanPropertyPostProcessor beanPropertyPostProcessor)
Removes a
BeanPropertyPostProcessor. |
default <T> T |
write(PropertyBox propertyBox,
T instance)
Write the property values contained into given
PropertyBox into given bean instance. |
default <T> T |
write(PropertyBox propertyBox,
T instance,
boolean ignoreMissing)
Write the property values contained into given
PropertyBox into given bean instance. |
default <T> BeanPropertySet<T> getPropertySet(Class<? extends T> beanClass)
beanClass and provides a BeanPropertySet to learn about bean
properties and configuration.T - Bean class typebeanClass - Bean class to introspect (not null)BeanPropertySet describing the target bean properties and configurationBeanIntrospector.BeanIntrospectionException - If an exception occurs during introspection<T> BeanPropertySet<T> getPropertySet(Class<? extends T> beanClass, Path<?> parentPath)
beanClass and provides a BeanPropertySet to learn about bean
properties and configuration. If a parentPath is specified, it will be setted as bean root
properties parent path.T - Bean class typebeanClass - Bean class to introspect (not null)parentPath - Optional parent path to set as bean root properties parent pathBeanPropertySet describing the target bean properties and configurationBeanIntrospector.BeanIntrospectionException - If an exception occurs during introspectiondefault <T> PropertyBox 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.
T - Bean typeignoreMissing - 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.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 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 <T> 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.
T - Bean typepropertyBox - 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 <T> T 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 Path will be taken into account, using Path.getName()
as property name.
Any PropertyValueConverter will be applied to write values to bean data model.
T - Bean typeignoreMissing - 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.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 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> 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 Path will be taken into account, using Path.getName()
as property name.
Any PropertyValueConverter will be applied to write values to bean data model.
T - Bean typepropertyBox - 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 propertyvoid addBeanPropertyPostProcessor(BeanPropertyPostProcessor beanPropertyPostProcessor)
BeanPropertyPostProcessor to handle BeanProperty configuration during introspection.beanPropertyPostProcessor - BeanPropertyPostProcessor to add (not null)void removeBeanPropertyPostProcessor(BeanPropertyPostProcessor beanPropertyPostProcessor)
BeanPropertyPostProcessor.beanPropertyPostProcessor - BeanPropertyPostProcessor to remove (not null)boolean clearCache()
true if caching is supported and was clearedstatic BeanIntrospector get()
BeanIntrospector instance.Context-bound BeanIntrospector instance, if available using CONTEXT_KEY as context
key, or the default instance for the default ClassLoader obtained through getDefault().static BeanIntrospector getDefault(ClassLoader classLoader)
BeanIntrospector using given classLoader.
The default introspector is inited loading BeanPropertyPostProcessors using fully qualified name of its
implementation class name to a com.holonplatform.core.beans.BeanPropertyPostProcessor file in the
META-INF/services directory.
classLoader - ClassLoader to usestatic BeanIntrospector getDefault()
BeanIntrospector using default ClassLoader.
The default introspector is inited loading BeanPropertyPostProcessors using fully qualified name of its
implementation class name to a com.holonplatform.core.beans.BeanPropertyPostProcessor file in the
META-INF/services directory.
Copyright © 2017 The Holon Platform. All rights reserved.