org.apache.commons.betwixt.io
Class BeanCreateRule

java.lang.Object
  extended by org.apache.commons.digester.Rule
      extended by org.apache.commons.betwixt.io.BeanCreateRule

Deprecated. 0.5 this Rule does not allowed good integration with other Rules - use BeanRuleSet instead.

public class BeanCreateRule
extends org.apache.commons.digester.Rule

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

Author:
James Strachan, Martin van den Bemt

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

Constructor Detail

BeanCreateRule

public BeanCreateRule(ElementDescriptor descriptor,
                      java.lang.Class beanClass,
                      java.lang.String pathPrefix)
Deprecated. 
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

BeanCreateRule

public BeanCreateRule(ElementDescriptor descriptor,
                      java.lang.Class beanClass,
                      java.lang.String pathPrefix,
                      boolean matchIDs)
Deprecated. 
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

BeanCreateRule

public BeanCreateRule(ElementDescriptor descriptor,
                      java.lang.Class beanClass)
Deprecated. 
Convenience constructor which uses ID's for matching.

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

BeanCreateRule

public BeanCreateRule(ElementDescriptor descriptor,
                      java.lang.Class beanClass,
                      boolean matchIDs)
Deprecated. 
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

BeanCreateRule

public BeanCreateRule(ElementDescriptor descriptor,
                      Context context,
                      java.lang.String pathPrefix)
Deprecated. 
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

BeanCreateRule

public BeanCreateRule(ElementDescriptor descriptor,
                      Context context,
                      java.lang.String pathPrefix,
                      boolean matchIDs)
Deprecated. 
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
Method Detail

setLog

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

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

begin

public void begin(org.xml.sax.Attributes attributes)
Deprecated. 
Process the beginning of this element.

Overrides:
begin in class org.apache.commons.digester.Rule
Parameters:
attributes - The attribute list of this element

end

public void end()
Deprecated. 
Process the end of this element.

Overrides:
end in class org.apache.commons.digester.Rule

finish

public void finish()
Deprecated. 
Tidy up.

Overrides:
finish in class org.apache.commons.digester.Rule

getClassNameAttribute

public java.lang.String getClassNameAttribute()
Deprecated. 
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. 
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

createBean

protected java.lang.Object createBean(org.xml.sax.Attributes attributes)
Deprecated. 
Factory method to create new bean instances

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

addChildRules

protected void addChildRules()
Deprecated. 
Adds the rules to the digester for all child elements


addChildRules

protected void addChildRules(java.lang.String prefix,
                             ElementDescriptor currentDescriptor)
Deprecated. 
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

getBeanReader

protected BeanReader getBeanReader()
Deprecated. 
Get the associated bean reader.

Returns:
the BeanReader

getElementDescriptor

protected ElementDescriptor getElementDescriptor(ElementDescriptor propertyDescriptor)
Deprecated. 
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.

addPrimitiveTypeRule

protected void addPrimitiveTypeRule(java.lang.String path,
                                    ElementDescriptor childDescriptor)
Deprecated. 
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

addRule

protected void addRule(java.lang.String path,
                       org.apache.commons.digester.Rule rule)
Deprecated. 
Safely add a rule with given path.

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

getBeansById

protected java.util.Map getBeansById()
Deprecated. 
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

toString

public java.lang.String toString()
Deprecated. 
Return something meaningful for logging.

Overrides:
toString in class java.lang.Object
Returns:
something useful for logging


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