org.apache.commons.betwixt.digester
Class ElementRule

java.lang.Object
  extended byorg.apache.commons.digester.Rule
      extended byorg.apache.commons.betwixt.digester.RuleSupport
          extended byorg.apache.commons.betwixt.digester.ElementRule

public class ElementRule
extends RuleSupport

ElementRule the digester Rule for parsing the <element> elements.

Version:
$Id: ElementRule.java,v 1.6 2003/01/07 22:32:57 rdonkin Exp $
Author:
James Strachan

Field Summary
private  java.lang.Class beanClass
          Class for which the .bewixt file is being digested
private  java.lang.ClassLoader classLoader
          Classloader used to load classes by name
private static org.apache.commons.logging.Log log
          Logger
 
Fields inherited from class org.apache.commons.digester.Rule
digester, namespaceURI
 
Constructor Summary
ElementRule()
          Base constructor
 
Method Summary
 void begin(org.xml.sax.Attributes attributes)
          Process the beginning of this element.
protected  void configureDescriptor(ElementDescriptor elementDescriptor)
          Set the Expression and Updater from a bean property name
 void end()
          Process the end of this element.
protected  java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.Class beanClass, java.lang.String propertyName)
          Returns the property descriptor for the class and property name.
protected  java.lang.Class getPropertyType(java.lang.String propertyClassName, java.lang.Class beanClass, java.lang.String propertyName)
          Gets the type of a property
 
Methods inherited from class org.apache.commons.betwixt.digester.RuleSupport
getBeanClass, getProcessedPropertyNameSet, getXMLInfoDigester, getXMLIntrospector
 
Methods inherited from class org.apache.commons.digester.Rule
begin, body, body, end, finish, getDigester, getNamespaceURI, setDigester, setNamespaceURI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

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


classLoader

private java.lang.ClassLoader classLoader
Classloader used to load classes by name


beanClass

private java.lang.Class beanClass
Class for which the .bewixt file is being digested

Constructor Detail

ElementRule

public ElementRule()
Base constructor

Method Detail

begin

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

Parameters:
attributes - The attribute list of this element
Throws:
org.xml.sax.SAXException - when this tag's parent is not either an info or element tag

end

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


getPropertyType

protected java.lang.Class getPropertyType(java.lang.String propertyClassName,
                                          java.lang.Class beanClass,
                                          java.lang.String propertyName)
Gets the type of a property

Parameters:
propertyClassName - class name for property type (may be null)
beanClass - class that has property
propertyName - the name of the property whose type is to be determined
Returns:
property type

configureDescriptor

protected void configureDescriptor(ElementDescriptor elementDescriptor)
Set the Expression and Updater from a bean property name

Parameters:
elementDescriptor - configure this ElementDescriptor

getPropertyDescriptor

protected java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.Class beanClass,
                                                              java.lang.String propertyName)
Returns the property descriptor for the class and property name. Note that some caching could be used to improve performance of this method. Or this method could be added to PropertyUtils.

Parameters:
beanClass - descriptor for property in this class
propertyName - descriptor for property with this name
Returns:
property descriptor for the named property in the given class