org.bibop.xml.xforge.components.mappers
Class XForgeReflectionMapper

java.lang.Object
  |
  +--org.bibop.xml.xforge.components.AbstractXForgeComponentMapper
        |
        +--org.bibop.xml.xforge.components.mappers.XForgeReflectionMapper
All Implemented Interfaces:
org.apache.avalon.framework.configuration.Configurable, XForgeComponentMapper, XMLProducer

public class XForgeReflectionMapper
extends AbstractXForgeComponentMapper
implements org.apache.avalon.framework.configuration.Configurable

A generic mapper that maps via reflection your object to an xforge component


Nested Class Summary
(package private)  class XForgeReflectionMapper.XForgeIllegalArgumentCastException
           
(package private)  class XForgeReflectionMapper.XForgeIllegalArgumentsException
           
(package private)  class XForgeReflectionMapper.XForgeIllegalMethodException
           
 
Field Summary
protected  java.lang.Object mappedObject
           
protected  java.util.Map methodstag
           
 
Fields inherited from class org.bibop.xml.xforge.components.AbstractXForgeComponentMapper
contentHandler, context, lexicalHandler, parameters
 
Constructor Summary
XForgeReflectionMapper()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration conf)
          Configure the object
protected  java.lang.Object[] convertArguments(java.util.LinkedList arguments, java.lang.Class[] argTypes)
          put your documentation comment here
protected  java.lang.reflect.Method getMethodByName(java.lang.reflect.Method[] methods, java.lang.String methodName, java.util.LinkedList arguments)
          get a method by the name and arguments
protected  java.lang.Object invokeMethod(java.lang.reflect.Method toInvoke, java.util.LinkedList arguments)
          invoke a method
protected  void objectToSax(java.lang.String methodName, java.lang.Object methodResult)
          utility to print a method result
protected  java.util.LinkedList parseArguments(java.lang.String toparse)
          utility to parse the method arguments
 void run()
          the method called by the mapped component
 void setMappedComponentClass(java.lang.String className)
          sets the class that is mapped
protected  java.lang.Object stringToObject(java.lang.String value, java.lang.Class finalType)
          put your documentation comment here
 
Methods inherited from class org.bibop.xml.xforge.components.AbstractXForgeComponentMapper
getParameters, getVariable, setConsumer, setContentHandler, setLexicalHandler, setParameters, setVariablesContext, toSax
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mappedObject

protected java.lang.Object mappedObject

methodstag

protected java.util.Map methodstag
Constructor Detail

XForgeReflectionMapper

public XForgeReflectionMapper()
Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration conf)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Configure the object

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Parameters:
conf -
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

setMappedComponentClass

public void setMappedComponentClass(java.lang.String className)
                             throws XForgeException
sets the class that is mapped

Specified by:
setMappedComponentClass in interface XForgeComponentMapper
Parameters:
className -
Throws:
XForgeException

run

public void run()
         throws XForgeException
the method called by the mapped component

Specified by:
run in interface XForgeComponentMapper
Overrides:
run in class AbstractXForgeComponentMapper
Throws:
XForgeException

objectToSax

protected void objectToSax(java.lang.String methodName,
                           java.lang.Object methodResult)
                    throws XForgeException
utility to print a method result

Parameters:
methodName -
methodResult -
Throws:
XForgeException

parseArguments

protected java.util.LinkedList parseArguments(java.lang.String toparse)
                                       throws XForgeException
utility to parse the method arguments

Parameters:
toparse -
Returns:
arguments parsed
Throws:
XForgeException

getMethodByName

protected java.lang.reflect.Method getMethodByName(java.lang.reflect.Method[] methods,
                                                   java.lang.String methodName,
                                                   java.util.LinkedList arguments)
                                            throws XForgeReflectionMapper.XForgeIllegalMethodException
get a method by the name and arguments

Parameters:
methods -
methodName -
arguments -
Returns:
the method
Throws:
XForgeReflectionMapper.XForgeIllegalMethodException

invokeMethod

protected java.lang.Object invokeMethod(java.lang.reflect.Method toInvoke,
                                        java.util.LinkedList arguments)
                                 throws XForgeReflectionMapper.XForgeIllegalMethodException
invoke a method

Parameters:
toInvoke -
arguments -
Returns:
Throws:
XForgeReflectionMapper.XForgeIllegalMethodException

convertArguments

protected java.lang.Object[] convertArguments(java.util.LinkedList arguments,
                                              java.lang.Class[] argTypes)
                                       throws XForgeReflectionMapper.XForgeIllegalArgumentsException
put your documentation comment here

Parameters:
arguments -
argTypes -
Returns:
Throws:
XForgeReflectionMapper.XForgeIllegalArgumentsException

stringToObject

protected java.lang.Object stringToObject(java.lang.String value,
                                          java.lang.Class finalType)
                                   throws XForgeReflectionMapper.XForgeIllegalArgumentCastException
put your documentation comment here

Parameters:
value -
finalType -
Returns:
Throws:
XForgeReflectionMapper.XForgeIllegalArgumentCastException


Copyright 2003 Bibop Research International. All Rights Reserved.