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.MappedPropertyRule
              extended byorg.apache.commons.betwixt.digester.ElementRule

public class ElementRule
extends MappedPropertyRule

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

Author:
James Strachan

Field Summary
private  java.lang.Class beanClass
          Class for which the .bewixt file is being digested
private static org.apache.commons.logging.Log log
          Logger
 
Fields inherited from class org.apache.commons.betwixt.digester.MappedPropertyRule
 
Fields inherited from class org.apache.commons.digester.Rule
digester, namespaceURI
 
Constructor Summary
ElementRule()
          Base constructor
 
Method Summary
 void begin(java.lang.String name, java.lang.String namespace, org.xml.sax.Attributes attributes)
          Process the beginning of this element.
protected  void configureDescriptor(ElementDescriptor elementDescriptor)
          Sets the Expression and Updater from a bean property name Uses the default updater (from the standard java bean property).
protected  void configureDescriptor(ElementDescriptor elementDescriptor, java.lang.String updateMethodName)
          Deprecated. now calls #configureDescriptor(ElementDescriptor, String, boolean) which allow accessibility to be forced. The subclassing API was not really considered carefully when this class was created. If anyone subclasses this method please contact the mailing list and suitable hooks will be placed into the code.
private  void configureDescriptor(ElementDescriptor elementDescriptor, java.lang.String updateMethodName, boolean forceAccessible)
          Sets the Expression and Updater from a bean property name Allows a custom updater to be passed in.
private  void configureProperty(ElementDescriptor elementDescriptor, java.beans.PropertyDescriptor propertyDescriptor, java.lang.String updateMethodName, boolean forceAccessible, java.lang.Class beanClass)
          Configure an ElementDescriptor from a PropertyDescriptor.
 void end(java.lang.String name, java.lang.String namespace)
          Process the end of this element.
private  java.lang.reflect.Method findAnyMethod(java.lang.String updateMethodName, java.lang.Class beanType, boolean isMapTypeProperty)
           
private  java.lang.reflect.Method findPublicMethod(java.lang.String updateMethodName, java.lang.Class beanType, boolean isMapTypeProperty)
           
private  java.lang.reflect.Method searchMethodsForMatch(java.lang.String updateMethodName, java.lang.reflect.Method[] methods, boolean isMapType)
           
static void setLog(org.apache.commons.logging.Log newLog)
          Sets the log for this class
 
Methods inherited from class org.apache.commons.betwixt.digester.MappedPropertyRule
getPropertyDescriptor, getPropertyType
 
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 org.apache.commons.logging.Log log
Logger


beanClass

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

Constructor Detail

ElementRule

public ElementRule()
Base constructor

Method Detail

setLog

public static final void setLog(org.apache.commons.logging.Log newLog)
Sets the log for this class

Parameters:
newLog - the new Log implementation for this class to use
Since:
0.5

begin

public void begin(java.lang.String name,
                  java.lang.String namespace,
                  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 - 1. If this tag's parent is not either an info or element tag. 2. If the name attribute is not valid XML element name. 3. If the name attribute is not present 4. If the class attribute is not a loadable (fully qualified) class name

end

public void end(java.lang.String name,
                java.lang.String namespace)
Process the end of this element.


configureDescriptor

protected void configureDescriptor(ElementDescriptor elementDescriptor)
Sets the Expression and Updater from a bean property name Uses the default updater (from the standard java bean property).

Parameters:
elementDescriptor - configure this ElementDescriptor
Since:
0.5

configureDescriptor

protected void configureDescriptor(ElementDescriptor elementDescriptor,
                                   java.lang.String updateMethodName)
Deprecated. now calls #configureDescriptor(ElementDescriptor, String, boolean) which allow accessibility to be forced. The subclassing API was not really considered carefully when this class was created. If anyone subclasses this method please contact the mailing list and suitable hooks will be placed into the code.

Sets the Expression and Updater from a bean property name Allows a custom updater to be passed in.

Parameters:
elementDescriptor - configure this ElementDescriptor
updateMethodName - custom update method. If null, then use standard
Since:
0.5

configureDescriptor

private void configureDescriptor(ElementDescriptor elementDescriptor,
                                 java.lang.String updateMethodName,
                                 boolean forceAccessible)
Sets the Expression and Updater from a bean property name Allows a custom updater to be passed in.

Parameters:
elementDescriptor - configure this ElementDescriptor
updateMethodName - custom update method. If null, then use standard
forceAccessible - if true and updateMethodName is not null, then non-public methods will be searched and made accessible (Method.setAccessible(true))

configureProperty

private void configureProperty(ElementDescriptor elementDescriptor,
                               java.beans.PropertyDescriptor propertyDescriptor,
                               java.lang.String updateMethodName,
                               boolean forceAccessible,
                               java.lang.Class beanClass)
Configure an ElementDescriptor from a PropertyDescriptor. A custom update method may be set.

Parameters:
elementDescriptor - configure this ElementDescriptor
propertyDescriptor - configure from this PropertyDescriptor
updateMethodName - the name of the custom updater method to user. If null, then then
forceAccessible - if true and updateMethodName is not null, then non-public methods will be searched and made accessible (Method.setAccessible(true))
beanClass - the Class from which the update method should be found. This may be null only when updateMethodName is also null.

findPublicMethod

private java.lang.reflect.Method findPublicMethod(java.lang.String updateMethodName,
                                                  java.lang.Class beanType,
                                                  boolean isMapTypeProperty)

searchMethodsForMatch

private java.lang.reflect.Method searchMethodsForMatch(java.lang.String updateMethodName,
                                                       java.lang.reflect.Method[] methods,
                                                       boolean isMapType)

findAnyMethod

private java.lang.reflect.Method findAnyMethod(java.lang.String updateMethodName,
                                               java.lang.Class beanType,
                                               boolean isMapTypeProperty)