Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.ws.jaxme.xs.parser.impl
Class AttributeSetterImpl  view AttributeSetterImpl download AttributeSetterImpl.java

java.lang.Object
  extended byorg.apache.ws.jaxme.xs.parser.impl.AttributeSetterImpl
All Implemented Interfaces:
org.apache.ws.jaxme.xs.parser.AttributeSetter

public class AttributeSetterImpl
extends java.lang.Object
implements org.apache.ws.jaxme.xs.parser.AttributeSetter

Default implementation of the org.apache.ws.jaxme.xs.parser.AttributeSetter interface.


Nested Class Summary
private static class AttributeSetterImpl.BooleanClass
           
private static class AttributeSetterImpl.CharacterClass
           
private static interface AttributeSetterImpl.ParameterClass
           
private static class AttributeSetterImpl.PrimitiveParameterClass
           
private static class AttributeSetterImpl.StringClass
           
private static class AttributeSetterImpl.StringConstructorClass
           
private static class AttributeSetterImpl.ValueOfParameterClass
           
 
Field Summary
private static java.lang.Class[] FOUR_STRING_CLASSES
           
private static AttributeSetterImpl.ParameterClass[] knownClasses
           
(package private) static java.lang.Class[] ONE_STRING_CLASS
           
 
Constructor Summary
AttributeSetterImpl()
           
 
Method Summary
protected  org.apache.ws.jaxme.xs.parser.XSContext getData()
           
protected  java.lang.Object invokeMethod(java.lang.Object pBean, java.lang.reflect.Method pMethod, java.lang.String pName, java.lang.Object[] pArgs)
          This method invokes the beans pBean method pMethod, setting the attribute pName to the value pArgs.
 void setAttribute(java.lang.String pQName, java.lang.String pNamespaceURI, java.lang.String pLocalName, java.lang.String pValue)
          This method configures the bean pBean as follows: If the bean has a method setAttribute(String, String, String), it is invoked with the following arguments: The attributes namespace URI (empty string for the default namespace), the attributes local name, and the property value Otherwise invokes its own method setProperty(Object, String, String, String) 55 .
protected  boolean setProperty(java.lang.Object pBean, java.lang.String pQName, java.lang.String pName, java.lang.String pValue)
          This method is invoked from within setAttribute(String, String, String, String) 55 .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ONE_STRING_CLASS

static final java.lang.Class[] ONE_STRING_CLASS

FOUR_STRING_CLASSES

private static final java.lang.Class[] FOUR_STRING_CLASSES

knownClasses

private static final AttributeSetterImpl.ParameterClass[] knownClasses
Constructor Detail

AttributeSetterImpl

public AttributeSetterImpl()
Method Detail

getData

protected org.apache.ws.jaxme.xs.parser.XSContext getData()

setAttribute

public void setAttribute(java.lang.String pQName,
                         java.lang.String pNamespaceURI,
                         java.lang.String pLocalName,
                         java.lang.String pValue)
                  throws org.xml.sax.SAXException

This method configures the bean pBean as follows:

  1. If the bean has a method setAttribute(String, String, String), it is invoked with the following arguments:
    • The attributes namespace URI (empty string for the default namespace),
    • the attributes local name,
    • and the property value
  2. Otherwise invokes its own method setProperty(Object, String, String, String) 55 .

Specified by:
setAttribute in interface org.apache.ws.jaxme.xs.parser.AttributeSetter

invokeMethod

protected java.lang.Object invokeMethod(java.lang.Object pBean,
                                        java.lang.reflect.Method pMethod,
                                        java.lang.String pName,
                                        java.lang.Object[] pArgs)
                                 throws org.xml.sax.SAXException

This method invokes the beans pBean method pMethod, setting the attribute pName to the value pArgs.


setProperty

protected boolean setProperty(java.lang.Object pBean,
                              java.lang.String pQName,
                              java.lang.String pName,
                              java.lang.String pValue)
                       throws org.xml.sax.SAXException

This method is invoked from within setAttribute(String, String, String, String) 55 . It configures the bean pBean as follows;

  1. If the bean has a method setProperty(String) this method is invoked with the attribute value.
  2. If the bean has a method setProperty(T), and the class T has either of a method public static T valueOf(String) or a constructor public T(String) (in that order), then the method setProperty(T) is invoked with the value obtained by an invocation of the method valueOf(), or the constructor, respectively. Note, that this applies in particular to the classes java.lang.Long, java.lang.Integer, java.lang.Short, java.lang.Byte, java.lang.Double, java.lang.Float, java.math.BigInteger, java.math.BigDecimal, java.io.File, and java.lang.StringBuffer.
  3. If the bean has a method setProperty(boolean), the method will be invoked with the value true (the value specified in the XML file is either of true, or 1, otherwise with the value false.
  4. If the bean has a method setProperty(char), or setProperty(Character), the method will be invoked with the first character of the value specified in the XML file. If the value contains zero or multiple characters, an java.lang.IllegalArgumentException is thrown.
  5. If the bean has either of the following methods, in that order:
    • setProperty(long)
    • setProperty(int)
    • setProperty(short)
    • setProperty(byte)
    • setProperty(double)
    • setProperty(float)
    then the property value is converted into the respective type and the method is invoked. An java.lang.IllegalArgumentException is thrown, if the conversion fails.
  6. If the bean has a method java.lang.Class, the XsSAXParser will interpret the value given in the XML file as a Java class name and load the named class from its class loader. If the class cannot be loaded, it will also try to use the current threads context class loader. An exception is thrown, if neither of the class loaders can load the class.