org.apache.commons.betwixt
Class IntrospectionConfiguration

java.lang.Object
  |
  +--org.apache.commons.betwixt.IntrospectionConfiguration

public class IntrospectionConfiguration
extends java.lang.Object

Stores introspection phase binding configuration.

There are two phase in Betwixt's processing. The first phase is the introspection of the bean. Strutural configuration settings effect this phase. The second phase comes when Betwixt dynamically uses reflection to execute the mapping. This object stores configuration settings pertaining to the first phase.

These common settings have been collected into one class so that they can be more easily shared not only between the objects that execute the introspection but also (by a user) between different XMLIntrospectors.

Version:
$Revision: 1.3 $
Author:
Jakarta Commons Team

Constructor Summary
IntrospectionConfiguration()
           
 
Method Summary
protected  NameMapper createNameMapper()
          A Factory method to lazily create a strategy used to convert bean type names into element names.
protected  PluralStemmer createPluralStemmer()
          A Factory method to lazily create a new strategy to detect matching singular and plural properties.
 NameMapper getAttributeNameMapper()
          Gets the name mapping strategy used to convert bean names into attributes.
 ClassNormalizer getClassNormalizer()
          Gets the ClassNormalizer strategy.
 NameMapper getElementNameMapper()
          Gets the name mapping strategy used to convert bean names into elements.
 org.apache.commons.logging.Log getIntrospectionLog()
          Gets the common Log used for introspection.
 PluralStemmer getPluralStemmer()
          Get singular and plural matching strategy.
 NamespacePrefixMapper getPrefixMapper()
          Gets the NamespacePrefixMapper used to convert namespace URIs into prefixes.
 SimpleTypeMapper getSimpleTypeMapper()
          Gets the simple type binding strategy.
 TypeBindingStrategy getTypeBindingStrategy()
          Gets the TypeBindingStrategy to be used to determine the binding for Java types.
 boolean isAttributesForPrimitives()
          Should attributes (or elements) be used for primitive types.
 boolean isWrapCollectionsInElement()
          Should collections be wrapped in an extra element?
 void setAttributeNameMapper(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 setClassNormalizer(ClassNormalizer classNormalizer)
          Sets the ClassNormalizer strategy.
 void setElementNameMapper(NameMapper nameMapper)
          Sets the strategy used to convert bean type names into element names
 void setIntrospectionLog(org.apache.commons.logging.Log log)
          Sets the common Log used by introspection.
 void setPluralStemmer(PluralStemmer pluralStemmer)
          Sets the strategy used to detect matching singular and plural properties
 void setPrefixMapper(NamespacePrefixMapper mapper)
          Sets the NamespacePrefixMapper used to convert namespave URIs into prefixes.
 void setSimpleTypeMapper(SimpleTypeMapper mapper)
          Sets the simple type binding strategy.
 void setTypeBindingStrategy(TypeBindingStrategy typeBindingStrategy)
          Sets the TypeBindingStrategy to be used to determine the binding for Java types.
 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
 

Constructor Detail

IntrospectionConfiguration

public IntrospectionConfiguration()
Method Detail

getClassNormalizer

public ClassNormalizer getClassNormalizer()
Gets the ClassNormalizer strategy. This is used to determine the Class to be introspected (the normalized Class).

Returns:
the ClassNormalizer used to determine the Class to be introspected for a given Object.

setClassNormalizer

public void setClassNormalizer(ClassNormalizer classNormalizer)
Sets the ClassNormalizer strategy. This is used to determine the Class to be introspected (the normalized Class).

Parameters:
classNormalizer - the ClassNormalizer to be used to determine the Class to be introspected for a given Object.

isAttributesForPrimitives

public boolean isAttributesForPrimitives()
Should attributes (or elements) be used for primitive types.

Returns:
true if primitive types will be mapped to attributes in the introspection

setAttributesForPrimitives

public void setAttributesForPrimitives(boolean attributesForPrimitives)
Set whether attributes (or elements) should be used for primitive types.

Parameters:
attributesForPrimitives - pass trus to map primitives to attributes, pass false to map primitives to elements

isWrapCollectionsInElement

public boolean isWrapCollectionsInElement()
Should collections be wrapped in an extra element?

Returns:
whether we should we wrap collections in an extra element?

setWrapCollectionsInElement

public void setWrapCollectionsInElement(boolean wrapCollectionsInElement)
Sets whether we should we wrap collections in an extra element.

Parameters:
wrapCollectionsInElement - pass true if collections should be wrapped in a parent element

getPluralStemmer

public PluralStemmer getPluralStemmer()
Get singular and plural matching strategy.

Returns:
the strategy used to detect matching singular and plural properties

setPluralStemmer

public void setPluralStemmer(PluralStemmer pluralStemmer)
Sets the strategy used to detect matching singular and plural properties

Parameters:
pluralStemmer - the PluralStemmer used to match singular and plural

getElementNameMapper

public NameMapper getElementNameMapper()
Gets the name mapping strategy used to convert bean names into elements.

Returns:
the strategy used to convert bean type names into element names. If no element mapper is currently defined then a default one is created.

setElementNameMapper

public void setElementNameMapper(NameMapper nameMapper)
Sets the strategy used to convert bean type names into element names

Parameters:
nameMapper - the NameMapper to use for the conversion

getAttributeNameMapper

public NameMapper getAttributeNameMapper()
Gets the name mapping strategy used to convert bean names into attributes.

Returns:
the strategy used to convert bean type names into attribute names. If no attributeNamemapper is known, it will default to the ElementNameMapper

setAttributeNameMapper

public void setAttributeNameMapper(NameMapper nameMapper)
Sets the strategy used to convert bean type names into attribute names

Parameters:
nameMapper - the NameMapper to use for the convertion

useBeanInfoSearchPath

public boolean useBeanInfoSearchPath()
Should the original java.reflect.Introspector bean info search path be used? By default it will be false.

Returns:
boolean if the beanInfoSearchPath should be used.

setUseBeanInfoSearchPath

public void setUseBeanInfoSearchPath(boolean useBeanInfoSearchPath)
Specifies if you want to use the beanInfoSearchPath

Parameters:
useBeanInfoSearchPath -
See Also:
for more details

createPluralStemmer

protected PluralStemmer createPluralStemmer()
A Factory method to lazily create a new strategy to detect matching singular and plural properties.

Returns:
new defualt PluralStemmer implementation

createNameMapper

protected NameMapper createNameMapper()
A Factory method to lazily create a strategy used to convert bean type names into element names.

Returns:
new default NameMapper implementation

getIntrospectionLog

public org.apache.commons.logging.Log getIntrospectionLog()
Gets the common Log used for introspection. It is more convenient to use a single Log that can be easily configured.

Returns:
Log, not null

setIntrospectionLog

public void setIntrospectionLog(org.apache.commons.logging.Log log)
Sets the common Log used by introspection. It is more convenient to use a single Log that can be easily configured.

Parameters:
log - Log, not null

getPrefixMapper

public NamespacePrefixMapper getPrefixMapper()
Gets the NamespacePrefixMapper used to convert namespace URIs into prefixes.

Returns:
NamespacePrefixMapper, not null

setPrefixMapper

public void setPrefixMapper(NamespacePrefixMapper mapper)
Sets the NamespacePrefixMapper used to convert namespave URIs into prefixes.

Parameters:
mapper - NamespacePrefixMapper, not null

getSimpleTypeMapper

public SimpleTypeMapper getSimpleTypeMapper()
Gets the simple type binding strategy.

Returns:
SimpleTypeMapper, not null

setSimpleTypeMapper

public void setSimpleTypeMapper(SimpleTypeMapper mapper)
Sets the simple type binding strategy.

Parameters:
mapper - SimpleTypeMapper, not null

getTypeBindingStrategy

public TypeBindingStrategy getTypeBindingStrategy()
Gets the TypeBindingStrategy to be used to determine the binding for Java types.

Returns:
the TypeBindingStrategy to be used, not null

setTypeBindingStrategy

public void setTypeBindingStrategy(TypeBindingStrategy typeBindingStrategy)
Sets the TypeBindingStrategy to be used to determine the binding for Java types.

Parameters:
typeBindingStrategy - the TypeBindingStrategy to be used, not null


Copyright © 2002-2004 The Apache Software Foundation. All Rights Reserved.