|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.betwixt.XMLIntrospector
XMLIntrospector
an introspector of beans to create a
XMLBeanInfo instance.
By default, XMLBeanInfo
caching is switched on.
This means that the first time that a request is made for a XMLBeanInfo
for a particular class, the XMLBeanInfo
is cached.
Later requests for the same class will return the cached value.
Note :
This class makes use of the java.bean.Introspector
class, which contains a BeanInfoSearchPath. To make sure betwixt can
do his work correctly, this searchpath is completely ignored during
processing. The original values will be restored after processing finished
Field Summary | |
protected org.apache.commons.logging.Log |
log
Log used for logging (Doh!) |
Constructor Summary | |
XMLIntrospector()
Base constructor |
Method Summary | |
protected void |
addProperties(java.beans.BeanInfo beanInfo,
java.util.List elements,
java.util.List attributes)
Deprecated. 0.5 this method does not support mixed content. Use addProperties(BeanInfo, List, List, List) instead. |
protected void |
addProperties(java.beans.BeanInfo beanInfo,
java.util.List elements,
java.util.List attributes,
java.util.List contents)
Deprecated. 0.5 use addProperties(BeanProperty[], List, List,List) |
protected void |
addProperties(org.apache.commons.betwixt.BeanProperty[] beanProperties,
java.util.List elements,
java.util.List attributes,
java.util.List contents)
Loop through properties and process each one |
protected void |
addProperty(java.beans.BeanInfo beanInfo,
java.beans.PropertyDescriptor propertyDescriptor,
java.util.List elements,
java.util.List attributes)
Deprecated. 0.5 this method does not support mixed content. Use addProperty(BeanInfo, PropertyDescriptor, List, List, List) instead. |
protected void |
addProperty(java.beans.BeanInfo beanInfo,
java.beans.PropertyDescriptor propertyDescriptor,
java.util.List elements,
java.util.List attributes,
java.util.List contents)
Deprecated. 0.5 BeanInfo is no longer required. Use addProperty(PropertyDescriptor, List, List, List) instead. |
protected void |
addProperty(org.apache.commons.betwixt.BeanProperty beanProperty,
java.util.List elements,
java.util.List attributes,
java.util.List contents)
Process a property. |
protected void |
addProperty(java.beans.PropertyDescriptor propertyDescriptor,
java.util.List elements,
java.util.List attributes,
java.util.List contents)
Deprecated. 0.5 use addProperty(BeanProperty, List, List, List) instead |
org.apache.commons.betwixt.Descriptor |
createDescriptor(java.beans.PropertyDescriptor propertyDescriptor,
boolean useAttributesForPrimitives)
Deprecated. 0.5 use createXMLDescriptor(org.apache.commons.betwixt.BeanProperty) . |
protected org.apache.commons.betwixt.strategy.NameMapper |
createNameMapper()
A Factory method to lazily create a strategy used to convert bean type names into element names. |
protected org.apache.commons.betwixt.strategy.PluralStemmer |
createPluralStemmer()
A Factory method to lazily create a new strategy to detect matching singular and plural properties. |
protected org.apache.commons.betwixt.XMLBeanInfo |
createXMLBeanInfo(java.beans.BeanInfo beanInfo)
Factory method to create XMLBeanInfo instances |
protected org.apache.commons.betwixt.XMLBeanInfo |
createXMLBeanInfo(org.apache.commons.beanutils.DynaClass dynaClass)
Creates XMLBeanInfo for the given DynaClass. |
org.apache.commons.betwixt.Descriptor |
createXMLDescriptor(org.apache.commons.betwixt.BeanProperty beanProperty)
Create a XML descriptor from a bean one. |
protected org.apache.commons.betwixt.XMLBeanInfo |
findByXMLDescriptor(java.lang.Class aClass)
Attempt to lookup the XML descriptor for the given class using the classname + ".betwixt" using the same ClassLoader used to load the class or return null if it could not be loaded |
void |
flushCache()
Deprecated. 0.5 use flushable registry instead |
org.apache.commons.betwixt.strategy.NameMapper |
getAttributeNameMapper()
Gets the name mapping strategy used to convert bean names into attributes. |
org.apache.commons.betwixt.strategy.ClassNormalizer |
getClassNormalizer()
Gets the ClassNormalizer strategy. |
org.apache.commons.betwixt.strategy.NameMapper |
getElementNameMapper()
Gets the name mapping strategy used to convert bean names into elements. |
org.apache.commons.logging.Log |
getLog()
Gets the current logging implementation. |
org.apache.commons.betwixt.strategy.NameMapper |
getNameMapper()
Deprecated. 0.5 getNameMapper is split up in getElementNameMapper() and getAttributeNameMapper() |
org.apache.commons.betwixt.strategy.PluralStemmer |
getPluralStemmer()
Get singular and plural matching strategy. |
org.apache.commons.betwixt.registry.XMLBeanInfoRegistry |
getRegistry()
Gets the current registry implementation. |
org.apache.commons.betwixt.XMLBeanInfo |
introspect(java.beans.BeanInfo beanInfo)
Create a standard XMLBeanInfo by introspection. |
org.apache.commons.betwixt.XMLBeanInfo |
introspect(java.lang.Class aClass)
Create a standard XMLBeanInfo by introspection. |
org.apache.commons.betwixt.XMLBeanInfo |
introspect(org.apache.commons.beanutils.DynaClass dynaClass)
Creates XMLBeanInfo by reading the DynaProperties of a DynaBean. |
org.apache.commons.betwixt.XMLBeanInfo |
introspect(java.lang.Object bean)
Create a standard XMLBeanInfo by introspection
The actual introspection depends only on the BeanInfo
associated with the bean. |
boolean |
isAttributesForPrimitives()
Should attributes (or elements) be used for primitive types. |
boolean |
isCachingEnabled()
Deprecated. 0.5 replaced by XMlBeanInfoRegistry |
boolean |
isLoopType(java.lang.Class type)
Is this class a loop? |
boolean |
isPrimitiveType(java.lang.Class type)
Is this class a primitive? |
boolean |
isWrapCollectionsInElement()
Should collections be wrapped in an extra element? |
void |
setAttributeNameMapper(org.apache.commons.betwixt.strategy.NameMapper nameMapper)
Sets the strategy used to convert bean type names into attribute names |
void |
setAttributesForPrimitives(boolean attributesForPrimitives)
Set whether attributes (or elements) should be used for primitive types. |
void |
setCachingEnabled(boolean cachingEnabled)
Deprecated. 0.5 replaced by XMlBeanInfoRegistry |
void |
setClassNormalizer(org.apache.commons.betwixt.strategy.ClassNormalizer classNormalizer)
Sets the ClassNormalizer strategy. |
void |
setElementNameMapper(org.apache.commons.betwixt.strategy.NameMapper nameMapper)
Sets the strategy used to convert bean type names into element names |
void |
setLog(org.apache.commons.logging.Log log)
Sets the current logging implementation. |
void |
setNameMapper(org.apache.commons.betwixt.strategy.NameMapper nameMapper)
Deprecated. 0.5 setNameMapper is split up in setElementNameMapper(NameMapper) and setAttributeNameMapper(NameMapper) |
void |
setPluralStemmer(org.apache.commons.betwixt.strategy.PluralStemmer pluralStemmer)
Sets the strategy used to detect matching singular and plural properties |
void |
setRegistry(org.apache.commons.betwixt.registry.XMLBeanInfoRegistry registry)
Sets the XMLBeanInfoRegistry implementation. |
void |
setUseBeanInfoSearchPath(boolean useBeanInfoSearchPath)
Specifies if you want to use the beanInfoSearchPath |
void |
setWrapCollectionsInElement(boolean wrapCollectionsInElement)
Sets whether we should we wrap collections in an extra element. |
boolean |
useBeanInfoSearchPath()
Should the original java.reflect.Introspector bean info search path be used?
By default it will be false. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected org.apache.commons.logging.Log log
Constructor Detail |
public XMLIntrospector()
Method Detail |
public org.apache.commons.logging.Log getLog()
Gets the current logging implementation.
public void setLog(org.apache.commons.logging.Log log)
Sets the current logging implementation.
log
- the Log implementation to use for loggingpublic org.apache.commons.betwixt.registry.XMLBeanInfoRegistry getRegistry()
Gets the current registry implementation.
The registry is checked to see if it has an XMLBeanInfo
for a class
before introspecting.
After standard introspection is complete, the instance will be passed to the registry.
This allows finely grained control over the caching strategy. It also allows the standard introspection mechanism to be overridden on a per class basis.
public void setRegistry(org.apache.commons.betwixt.registry.XMLBeanInfoRegistry registry)
Sets the XMLBeanInfoRegistry
implementation.
The registry is checked to see if it has an XMLBeanInfo
for a class
before introspecting.
After standard introspection is complete, the instance will be passed to the registry.
This allows finely grained control over the caching strategy. It also allows the standard introspection mechanism to be overridden on a per class basis.
registry
- the XMLBeanInfoRegistry to usepublic org.apache.commons.betwixt.strategy.ClassNormalizer getClassNormalizer()
ClassNormalizer
strategy.
This is used to determine the Class to be introspected
(the normalized Class).
ClassNormalizer
used to determine the Class to be introspected
for a given Object.public void setClassNormalizer(org.apache.commons.betwixt.strategy.ClassNormalizer classNormalizer)
ClassNormalizer
strategy.
This is used to determine the Class to be introspected
(the normalized Class).
classNormalizer
- the ClassNormalizer
to be used to determine
the Class to be introspected for a given Object.public boolean isCachingEnabled()
XMLBeanInfo
caching enabled?
public void setCachingEnabled(boolean cachingEnabled)
XMLBeanInfo
caching should be enabled.
cachingEnabled
- ignoredpublic void flushCache()
XMLBeanInfo
's.
public org.apache.commons.betwixt.XMLBeanInfo introspect(java.lang.Object bean) throws java.beans.IntrospectionException
XMLBeanInfo
by introspection
The actual introspection depends only on the BeanInfo
associated with the bean.
bean
- introspect this bean
java.beans.IntrospectionException
- when the bean introspection failspublic org.apache.commons.betwixt.XMLBeanInfo introspect(org.apache.commons.beanutils.DynaClass dynaClass)
dynaClass
- the DynaBean to introspect
public org.apache.commons.betwixt.XMLBeanInfo introspect(java.lang.Class aClass) throws java.beans.IntrospectionException
XMLBeanInfo
by introspection.
The actual introspection depends only on the BeanInfo
associated with the bean.
aClass
- introspect this class
java.beans.IntrospectionException
- when the bean introspection failspublic org.apache.commons.betwixt.XMLBeanInfo introspect(java.beans.BeanInfo beanInfo) throws java.beans.IntrospectionException
XMLBeanInfo
by introspection.
The actual introspection depends only on the BeanInfo
associated with the bean.
beanInfo
- the BeanInfo the xml-bean mapping is based on
java.beans.IntrospectionException
- when the bean introspection failsprotected org.apache.commons.betwixt.XMLBeanInfo createXMLBeanInfo(org.apache.commons.beanutils.DynaClass dynaClass)
dynaClass
- the class describing a DynaBean
public boolean isAttributesForPrimitives()
public void setAttributesForPrimitives(boolean attributesForPrimitives)
attributesForPrimitives
- pass trus to map primitives to attributes,
pass false to map primitives to elementspublic boolean isWrapCollectionsInElement()
public void setWrapCollectionsInElement(boolean wrapCollectionsInElement)
wrapCollectionsInElement
- pass true if collections should be wrapped in a
parent elementpublic org.apache.commons.betwixt.strategy.PluralStemmer getPluralStemmer()
public void setPluralStemmer(org.apache.commons.betwixt.strategy.PluralStemmer pluralStemmer)
pluralStemmer
- the PluralStemmer used to match singular and pluralpublic org.apache.commons.betwixt.strategy.NameMapper getNameMapper()
getElementNameMapper()
and getAttributeNameMapper()
public void setNameMapper(org.apache.commons.betwixt.strategy.NameMapper nameMapper)
setElementNameMapper(NameMapper)
and setAttributeNameMapper(NameMapper)
nameMapper
- the NameMapper strategy to be usedpublic org.apache.commons.betwixt.strategy.NameMapper getElementNameMapper()
public void setElementNameMapper(org.apache.commons.betwixt.strategy.NameMapper nameMapper)
nameMapper
- the NameMapper to use for the conversionpublic org.apache.commons.betwixt.strategy.NameMapper getAttributeNameMapper()
public void setAttributeNameMapper(org.apache.commons.betwixt.strategy.NameMapper nameMapper)
nameMapper
- the NameMapper to use for the convertionpublic org.apache.commons.betwixt.Descriptor createDescriptor(java.beans.PropertyDescriptor propertyDescriptor, boolean useAttributesForPrimitives) throws java.beans.IntrospectionException
createXMLDescriptor(org.apache.commons.betwixt.BeanProperty)
.
propertyDescriptor
- create a NodeDescriptor
for this propertyuseAttributesForPrimitives
- write primitives as attributes (rather than elements)
NodeDescriptor
for the property
java.beans.IntrospectionException
- when bean introspection failspublic org.apache.commons.betwixt.Descriptor createXMLDescriptor(org.apache.commons.betwixt.BeanProperty beanProperty)
beanProperty
- the BeanProperty specifying the property
NodeDescriptor
for the propertyprotected org.apache.commons.betwixt.strategy.PluralStemmer createPluralStemmer()
protected org.apache.commons.betwixt.strategy.NameMapper createNameMapper()
protected org.apache.commons.betwixt.XMLBeanInfo findByXMLDescriptor(java.lang.Class aClass)
aClass
- digester .betwixt file for this class
protected void addProperties(java.beans.BeanInfo beanInfo, java.util.List elements, java.util.List attributes, java.util.List contents) throws java.beans.IntrospectionException
addProperties(BeanProperty[], List, List,List)
beanInfo
- the BeanInfo whose properties will be processedelements
- ElementDescriptor list to which elements will be addedattributes
- AttributeDescriptor list to which attributes will be addedcontents
- Descriptor list to which mixed content will be added
java.beans.IntrospectionException
- if the bean introspection failsprotected void addProperties(org.apache.commons.betwixt.BeanProperty[] beanProperties, java.util.List elements, java.util.List attributes, java.util.List contents)
beanProperties
- the properties to be processedelements
- ElementDescriptor list to which elements will be addedattributes
- AttributeDescriptor list to which attributes will be addedcontents
- Descriptor list to which mixed content will be addedprotected void addProperty(java.beans.BeanInfo beanInfo, java.beans.PropertyDescriptor propertyDescriptor, java.util.List elements, java.util.List attributes, java.util.List contents) throws java.beans.IntrospectionException
addProperty(PropertyDescriptor, List, List, List)
instead.
beanInfo
- the BeanInfo whose property is being processedpropertyDescriptor
- the PropertyDescriptor to processelements
- ElementDescriptor list to which elements will be addedattributes
- AttributeDescriptor list to which attributes will be addedcontents
- Descriptor list to which mixed content will be added
java.beans.IntrospectionException
- if the bean introspection failsprotected void addProperty(java.beans.PropertyDescriptor propertyDescriptor, java.util.List elements, java.util.List attributes, java.util.List contents) throws java.beans.IntrospectionException
addProperty(BeanProperty, List, List, List)
instead
propertyDescriptor
- the PropertyDescriptor to processelements
- ElementDescriptor list to which elements will be addedattributes
- AttributeDescriptor list to which attributes will be addedcontents
- Descriptor list to which mixed content will be added
java.beans.IntrospectionException
- if the bean introspection failsprotected void addProperty(org.apache.commons.betwixt.BeanProperty beanProperty, java.util.List elements, java.util.List attributes, java.util.List contents)
beanProperty
- the bean property to processelements
- ElementDescriptor list to which elements will be addedattributes
- AttributeDescriptor list to which attributes will be addedcontents
- Descriptor list to which mixed content will be addedprotected void addProperties(java.beans.BeanInfo beanInfo, java.util.List elements, java.util.List attributes) throws java.beans.IntrospectionException
addProperties(BeanInfo, List, List, List)
instead.
beanInfo
- the BeanInfo whose properties will be processedelements
- ElementDescriptor list to which elements will be addedattributes
- AttributeDescriptor list to which attributes will be added
java.beans.IntrospectionException
- if the bean introspection failsprotected void addProperty(java.beans.BeanInfo beanInfo, java.beans.PropertyDescriptor propertyDescriptor, java.util.List elements, java.util.List attributes) throws java.beans.IntrospectionException
addProperty(BeanInfo, PropertyDescriptor, List, List, List)
instead.
beanInfo
- the BeanInfo whose property is being processedpropertyDescriptor
- the PropertyDescriptor to processelements
- ElementDescriptor list to which elements will be addedattributes
- AttributeDescriptor list to which attributes will be added
java.beans.IntrospectionException
- if the bean introspection failsprotected org.apache.commons.betwixt.XMLBeanInfo createXMLBeanInfo(java.beans.BeanInfo beanInfo)
beanInfo
- the BeanInfo from which the XMLBeanInfo will be created
public boolean isLoopType(java.lang.Class type)
type
- the Class to test
public boolean isPrimitiveType(java.lang.Class type)
type
- the Class to test
public boolean useBeanInfoSearchPath()
java.reflect.Introspector
bean info search path be used?
By default it will be false.
public void setUseBeanInfoSearchPath(boolean useBeanInfoSearchPath)
useBeanInfoSearchPath
- for more details
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |