Package org.apache.commons.beanutils
Interface IntrospectionContext
-
- All Known Implementing Classes:
DefaultIntrospectionContext
public interface IntrospectionContext
A context interface used during introspection for querying and setting property descriptors.
An implementation of this interface is passed to
BeanIntrospector
objects during processing of a bean class. It allows theBeanIntrospector
to deliver descriptors for properties it has detected. It is also possible to find out which properties have already been found by anotherBeanIntrospector
; this allows multipleBeanIntrospector
instances to collaborate.- Since:
- 1.9
- Version:
- $Id$
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addPropertyDescriptor(java.beans.PropertyDescriptor desc)
Adds the given property descriptor to this context.void
addPropertyDescriptors(java.beans.PropertyDescriptor[] descriptors)
Adds an array of property descriptors to this context.java.beans.PropertyDescriptor
getPropertyDescriptor(java.lang.String name)
Returns the descriptor for the property with the given name or null if this property is unknown.java.lang.Class<?>
getTargetClass()
Returns the class that is subject of introspection.boolean
hasProperty(java.lang.String name)
Tests whether a descriptor for the property with the given name is already contained in this context.java.util.Set<java.lang.String>
propertyNames()
Returns a set with the names of all properties known to this context.void
removePropertyDescriptor(java.lang.String name)
Removes the descriptor for the property with the given name.
-
-
-
Method Detail
-
getTargetClass
java.lang.Class<?> getTargetClass()
Returns the class that is subject of introspection.- Returns:
- the current class
-
addPropertyDescriptor
void addPropertyDescriptor(java.beans.PropertyDescriptor desc)
Adds the given property descriptor to this context. This method is called by aBeanIntrospector
during introspection for each detected property. If this context already contains a descriptor for the affected property, it is overridden.- Parameters:
desc
- the property descriptor
-
addPropertyDescriptors
void addPropertyDescriptors(java.beans.PropertyDescriptor[] descriptors)
Adds an array of property descriptors to this context. Using this method multiple descriptors can be added at once.- Parameters:
descriptors
- the array of descriptors to be added
-
hasProperty
boolean hasProperty(java.lang.String name)
Tests whether a descriptor for the property with the given name is already contained in this context. This method can be used for instance to prevent that an already existing property descriptor is overridden.- Parameters:
name
- the name of the property in question- Returns:
- true if a descriptor for this property has already been added, false otherwise
-
getPropertyDescriptor
java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.String name)
Returns the descriptor for the property with the given name or null if this property is unknown.- Parameters:
name
- the name of the property in question- Returns:
- the descriptor for this property or null if this property is unknown
-
removePropertyDescriptor
void removePropertyDescriptor(java.lang.String name)
Removes the descriptor for the property with the given name.- Parameters:
name
- the name of the affected property
-
propertyNames
java.util.Set<java.lang.String> propertyNames()
Returns a set with the names of all properties known to this context.- Returns:
- a set with the known property names
-
-