public class

BeanCreateRule

extends Rule
java.lang.Object
   ↳ org.apache.commons.digester.Rule
     ↳ org.apache.commons.betwixt.io.BeanCreateRule

This class is deprecated.
0.5 this Rule does not allowed good integration with other Rules - use BeanRuleSet instead.

Class Overview

BeanCreateRule is a Digester Rule for creating beans from the betwixt XML metadata.

Summary

[Expand]
Inherited Fields
From class org.apache.commons.digester.Rule
Public Constructors
BeanCreateRule(ElementDescriptor descriptor, Class beanClass, String pathPrefix)
Convenience constructor which uses ID's for matching.
BeanCreateRule(ElementDescriptor descriptor, Class beanClass, String pathPrefix, boolean matchIDs)
Constructor taking a class.
BeanCreateRule(ElementDescriptor descriptor, Class beanClass)
Convenience constructor which uses ID's for matching.
BeanCreateRule(ElementDescriptor descriptor, Class beanClass, boolean matchIDs)
Constructor uses standard qualified name.
BeanCreateRule(ElementDescriptor descriptor, Context context, String pathPrefix)
Convenience constructor which uses ID's for match.
BeanCreateRule(ElementDescriptor descriptor, Context context, String pathPrefix, boolean matchIDs)
Constructor taking a context.
Public Methods
void begin(Attributes attributes)
Process the beginning of this element.
void end()
Process the end of this element.
void finish()
Tidy up.
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.
void setClassNameAttribute(String classNameAttribute)
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.
static void setLog(Log aLog)
Set log to be used by BeanCreateRule instances
String toString()
Return something meaningful for logging.
Protected Methods
void addChildRules(String prefix, ElementDescriptor currentDescriptor)
Add child rules for given descriptor at given prefix
void addChildRules()
Adds the rules to the digester for all child elements
void addPrimitiveTypeRule(String path, ElementDescriptor childDescriptor)
Adds a new Digester rule to process the text as a primitive type
void addRule(String path, Rule rule)
Safely add a rule with given path.
Object createBean(Attributes attributes)
Factory method to create new bean instances
BeanReader getBeanReader()
Get the associated bean reader.
Map getBeansById()
Get the map used to index beans (previously read in) by id.
ElementDescriptor getElementDescriptor(ElementDescriptor propertyDescriptor)
Allows the navigation from a reference to a property object to the descriptor defining what the property is.
[Expand]
Inherited Methods
From class org.apache.commons.digester.Rule
From class java.lang.Object

Public Constructors

public BeanCreateRule (ElementDescriptor descriptor, Class beanClass, String pathPrefix)

Convenience constructor which uses ID's for matching.

Parameters
descriptor the ElementDescriptor describing the element mapped
beanClass the Class to be created
pathPrefix the digester style path

public BeanCreateRule (ElementDescriptor descriptor, Class beanClass, String pathPrefix, boolean matchIDs)

Constructor taking a class.

Parameters
descriptor the ElementDescriptor describing the element mapped
beanClass the Class to be created
pathPrefix the digester style path
matchIDs should ID/IDREF's be used for matching

public BeanCreateRule (ElementDescriptor descriptor, Class beanClass)

Convenience constructor which uses ID's for matching.

Parameters
descriptor the ElementDescriptor describing the element mapped
beanClass the Class to be created

public BeanCreateRule (ElementDescriptor descriptor, Class beanClass, boolean matchIDs)

Constructor uses standard qualified name.

Parameters
descriptor the ElementDescriptor describing the element mapped
beanClass the Class to be created
matchIDs should ID/IDREF's be used for matching

public BeanCreateRule (ElementDescriptor descriptor, Context context, String pathPrefix)

Convenience constructor which uses ID's for match.

Parameters
descriptor the ElementDescriptor describing the element mapped
context the Context to be used to evaluate expressions
pathPrefix the digester path prefix

public BeanCreateRule (ElementDescriptor descriptor, Context context, String pathPrefix, boolean matchIDs)

Constructor taking a context.

Parameters
descriptor the ElementDescriptor describing the element mapped
context the Context to be used to evaluate expressions
pathPrefix the digester path prefix
matchIDs should ID/IDREF's be used for matching

Public Methods

public void begin (Attributes attributes)

Process the beginning of this element.

Parameters
attributes The attribute list of this element

public void end ()

Process the end of this element.

public void finish ()

Tidy up.

public 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

public void setClassNameAttribute (String classNameAttribute)

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

public static void setLog (Log aLog)

Set log to be used by BeanCreateRule instances

Parameters
aLog the Log implementation for this class to log to

public String toString ()

Return something meaningful for logging.

Returns
  • something useful for logging

Protected Methods

protected void addChildRules (String prefix, ElementDescriptor currentDescriptor)

Add child rules for given descriptor at given prefix

Parameters
prefix add child rules at this (digester) path prefix
currentDescriptor add child rules for this descriptor

protected void addChildRules ()

Adds the rules to the digester for all child elements

protected void addPrimitiveTypeRule (String path, ElementDescriptor childDescriptor)

Adds a new Digester rule to process the text as a primitive type

Parameters
path digester path where this rule will be attached
childDescriptor update this ElementDescriptor with the body text

protected void addRule (String path, Rule rule)

Safely add a rule with given path.

Parameters
path the digester path to add rule at
rule the Rule to add

protected Object createBean (Attributes attributes)

Factory method to create new bean instances

Parameters
attributes the Attributes used to match ID/IDREF
Returns
  • the created bean

protected BeanReader getBeanReader ()

Get the associated bean reader.

Returns
  • the BeanReader

protected Map getBeansById ()

Get the map used to index beans (previously read in) by id. This is stored in the evaluation context.

Returns
  • map indexing beans created by id

protected ElementDescriptor getElementDescriptor (ElementDescriptor propertyDescriptor)

Allows the navigation from a reference to a property object to the descriptor defining what the property is. In other words, doing the join from a reference to a type to lookup its descriptor. This could be done automatically by the NodeDescriptors. Refer to TODO.txt for more info.

Parameters
propertyDescriptor find descriptor for property object referenced by this descriptor
Returns
  • descriptor for the singular property class type referenced.