org.apache.commons.betwixt.io
Class BeanRuleSet

java.lang.Object
  extended by org.apache.commons.betwixt.io.BeanRuleSet
All Implemented Interfaces:
org.apache.commons.digester.RuleSet

public class BeanRuleSet
extends java.lang.Object
implements org.apache.commons.digester.RuleSet

Sets Betwixt digestion rules for a bean class.

Since:
0.5
Author:
Robert Burrell Donkin, Martin van den Bemt

Nested Class Summary
private  class BeanRuleSet.ActionMappingRule
          Single rule that is used to map all elements.
private static class BeanRuleSet.DigesterReadContext
          Specialization of ReadContext when reading from Digester.
 
Field Summary
private  ElementDescriptor baseElementDescriptor
          The element descriptor for the base
private  java.lang.String basePath
          The base path under which the rules will be attached
private  java.lang.String classNameAttribute
          allows an attribute to be specified to overload the types of beans used
private  BeanRuleSet.DigesterReadContext context
          The (empty) base context from which all Contexts with beans are (directly or indirectly) obtained
private static org.apache.commons.logging.Log log
          Logger
 
Constructor Summary
BeanRuleSet(XMLIntrospector introspector, java.lang.String basePath, ElementDescriptor baseElementDescriptor, java.lang.Class baseBeanClass, boolean matchIDs)
          Deprecated. 0.5 use constructor which takes a ReadContext instead
BeanRuleSet(XMLIntrospector introspector, java.lang.String basePath, ElementDescriptor baseElementDescriptor, java.lang.Class baseBeanClass, Context context)
          Deprecated. 0.5 use the constructor which takes a ReadContext instead
BeanRuleSet(XMLIntrospector introspector, java.lang.String basePath, ElementDescriptor baseElementDescriptor, java.lang.Class baseBeanClass, ReadContext baseContext)
          Base constructor.
BeanRuleSet(XMLIntrospector introspector, java.lang.String basePath, ElementDescriptor baseElementDescriptor, Context context)
          Deprecated. 0.6 use the constructor which takes a ReadContext instead
 
Method Summary
 void addRuleInstances(org.apache.commons.digester.Digester digester)
          Add rules for bean to given Digester.
 java.lang.String getClassNameAttribute()
          The name of the attribute which can be specified in the XML to override the type of a bean used at a certain point in the schema.
 java.lang.String getNamespaceURI()
          Gets the namespace associated with this ruleset.
 void setClassNameAttribute(java.lang.String classNameAttribute)
          Deprecated. 0.5 set the ReadContext property instead
static void setLog(org.apache.commons.logging.Log aLog)
          Set log to be used by BeanRuleSet instances
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log
Logger


basePath

private java.lang.String basePath
The base path under which the rules will be attached


baseElementDescriptor

private ElementDescriptor baseElementDescriptor
The element descriptor for the base


context

private BeanRuleSet.DigesterReadContext context
The (empty) base context from which all Contexts with beans are (directly or indirectly) obtained


classNameAttribute

private java.lang.String classNameAttribute
allows an attribute to be specified to overload the types of beans used

Constructor Detail

BeanRuleSet

public BeanRuleSet(XMLIntrospector introspector,
                   java.lang.String basePath,
                   ElementDescriptor baseElementDescriptor,
                   java.lang.Class baseBeanClass,
                   boolean matchIDs)
Deprecated. 0.5 use constructor which takes a ReadContext instead

Base constructor.

Parameters:
introspector - the XMLIntrospector used to introspect
basePath - specifies the (Digester-style) path under which the rules will be attached
baseElementDescriptor - the ElementDescriptor used to create the rules
baseBeanClass - the Class whose mapping rules will be created
matchIDs - should ID/IDREFs be used to match beans?

BeanRuleSet

public BeanRuleSet(XMLIntrospector introspector,
                   java.lang.String basePath,
                   ElementDescriptor baseElementDescriptor,
                   Context context)
Deprecated. 0.6 use the constructor which takes a ReadContext instead

Base constructor.

Parameters:
introspector - the XMLIntrospector used to introspect
basePath - specifies the (Digester-style) path under which the rules will be attached
baseElementDescriptor - the ElementDescriptor used to create the rules
context - the root Context that bean carrying Contexts should be obtained from, not null

BeanRuleSet

public BeanRuleSet(XMLIntrospector introspector,
                   java.lang.String basePath,
                   ElementDescriptor baseElementDescriptor,
                   java.lang.Class baseBeanClass,
                   Context context)
Deprecated. 0.5 use the constructor which takes a ReadContext instead

Base constructor.

Parameters:
introspector - the XMLIntrospector used to introspect
basePath - specifies the (Digester-style) path under which the rules will be attached
baseElementDescriptor - the ElementDescriptor used to create the rules
baseBeanClass - the Class whose mapping rules will be created
context - the root Context that bean carrying Contexts should be obtained from, not null

BeanRuleSet

public BeanRuleSet(XMLIntrospector introspector,
                   java.lang.String basePath,
                   ElementDescriptor baseElementDescriptor,
                   java.lang.Class baseBeanClass,
                   ReadContext baseContext)
Base constructor.

Parameters:
introspector - the XMLIntrospector used to introspect
basePath - specifies the (Digester-style) path under which the rules will be attached
baseElementDescriptor - the ElementDescriptor used to create the rules
baseBeanClass - the Class whose mapping rules will be created
baseContext - the root Context that bean carrying Contexts should be obtained from, not null
Method Detail

setLog

public static void setLog(org.apache.commons.logging.Log aLog)
Set log to be used by BeanRuleSet instances

Parameters:
aLog - the Log implementation for this class to log to

getClassNameAttribute

public java.lang.String getClassNameAttribute()
The name of the attribute which can be specified in the XML to override the type of a bean used at a certain point in the schema.

The default value is 'className'.

Returns:
The name of the attribute used to overload the class name of a bean

setClassNameAttribute

public void setClassNameAttribute(java.lang.String classNameAttribute)
Deprecated. 0.5 set the ReadContext property instead

Sets the name of the attribute which can be specified in the XML to override the type of a bean used at a certain point in the schema.

The default value is 'className'.

Parameters:
classNameAttribute - The name of the attribute used to overload the class name of a bean

getNamespaceURI

public java.lang.String getNamespaceURI()

Gets the namespace associated with this ruleset.

Note namespaces are not currently supported.

Specified by:
getNamespaceURI in interface org.apache.commons.digester.RuleSet
Returns:
null

addRuleInstances

public void addRuleInstances(org.apache.commons.digester.Digester digester)
Add rules for bean to given Digester.

Specified by:
addRuleInstances in interface org.apache.commons.digester.RuleSet
Parameters:
digester - the Digester to which the rules for the bean will be added