public class XMLIntrospectorHelper extends Object
XMLIntrospectorHelper
a helper class for
common code shared between the digestor and introspector.
Modifier and Type | Field and Description |
---|---|
protected static Log |
log
Log used for logging (Doh!)
|
Constructor and Description |
---|
XMLIntrospectorHelper()
Base constructor
|
Modifier and Type | Method and Description |
---|---|
static void |
configureProperty(AttributeDescriptor attributeDescriptor,
PropertyDescriptor propertyDescriptor)
Configure an
AttributeDescriptor from a PropertyDescriptor |
static void |
configureProperty(ElementDescriptor elementDescriptor,
PropertyDescriptor propertyDescriptor)
Configure an
ElementDescriptor from a PropertyDescriptor |
static NodeDescriptor |
createDescriptor(PropertyDescriptor propertyDescriptor,
boolean useAttributesForPrimitives,
XMLIntrospector introspector)
Process a property.
|
static void |
defaultAddMethods(XMLIntrospector introspector,
ElementDescriptor rootDescriptor,
Class beanClass)
Add any addPropety(PropertyType) methods as Updaters
which are often used for 1-N relationships in beans.
|
protected static ElementDescriptor |
findGetCollectionDescriptor(XMLIntrospector introspector,
ElementDescriptor rootDescriptor,
String propertyName)
Attempts to find the element descriptor for the getter property that
typically matches a collection or array.
|
static Log |
getLog()
Gets the current logging implementation.
|
static boolean |
isLoopType(Class type)
Is this a loop type class?
|
static boolean |
isPrimitiveType(Class type)
Is this a primitive type?
|
protected static void |
makeElementDescriptorMap(ElementDescriptor rootDescriptor,
Map map)
Creates a map where the keys are the property names and the values are the ElementDescriptors
|
static void |
setLog(Log aLog)
Sets the current logging implementation.
|
protected static void |
swapDescriptor(ElementDescriptor rootDescriptor,
ElementDescriptor oldValue,
ElementDescriptor newValue)
Traverse the tree of element descriptors and find the oldValue and swap it with the newValue.
|
protected static Log log
public static Log getLog()
Gets the current logging implementation.
public static void setLog(Log aLog)
Sets the current logging implementation.
aLog
- use this Log
public static NodeDescriptor createDescriptor(PropertyDescriptor propertyDescriptor, boolean useAttributesForPrimitives, XMLIntrospector introspector) throws IntrospectionException
propertyDescriptor
- create a NodeDescriptor
for this propertyuseAttributesForPrimitives
- write primitives as attributes (rather than elements)introspector
- use this XMLIntrospector
NodeDescriptor
for the propertyIntrospectionException
- when bean introspection failspublic static void configureProperty(ElementDescriptor elementDescriptor, PropertyDescriptor propertyDescriptor)
ElementDescriptor
from a PropertyDescriptor
elementDescriptor
- configure this ElementDescriptor
propertyDescriptor
- configure from this PropertyDescriptor
public static void configureProperty(AttributeDescriptor attributeDescriptor, PropertyDescriptor propertyDescriptor)
AttributeDescriptor
from a PropertyDescriptor
attributeDescriptor
- configure this AttributeDescriptor
propertyDescriptor
- configure from this PropertyDescriptor
public static void defaultAddMethods(XMLIntrospector introspector, ElementDescriptor rootDescriptor, Class beanClass)
introspector
- use this XMLIntrospector
for introspectionrootDescriptor
- add defaults to this descriptorbeanClass
- the Class
to which descriptor correspondspublic static boolean isLoopType(Class type)
type
- is this Class
a loop type?public static boolean isPrimitiveType(Class type)
type
- is this Class a primitive type?
protected static ElementDescriptor findGetCollectionDescriptor(XMLIntrospector introspector, ElementDescriptor rootDescriptor, String propertyName)
introspector
- use this XMLIntrospector
rootDescriptor
- the ElementDescriptor
whose child element will be
searched for a matchpropertyName
- the name of the 'adder' method to matchElementDescriptor
for the matching getterprotected static void makeElementDescriptorMap(ElementDescriptor rootDescriptor, Map map)
rootDescriptor
- the values of the maps are the children of this
ElementDescriptor
index by their property namesmap
- the map to which the elements will be addedprotected static void swapDescriptor(ElementDescriptor rootDescriptor, ElementDescriptor oldValue, ElementDescriptor newValue)
rootDescriptor
- traverse child graph for this ElementDescriptor
oldValue
- replace this ElementDescriptor
newValue
- replace with this ElementDescriptor