org.progeeks.util.xml
Class ConstructedBeanHandler

java.lang.Object
  extended by org.progeeks.util.xml.AbstractObjectHandler
      extended by org.progeeks.util.xml.BeanObjectHandler
          extended by org.progeeks.util.xml.BeanConfiguratorHandler
              extended by org.progeeks.util.xml.ConstructedBeanHandler
All Implemented Interfaces:
ObjectHandler

public class ConstructedBeanHandler
extends BeanConfiguratorHandler

Object handler that uses BeanConfigurators to delay the creation of objects until a list of constructor arguments can be collected. Example XML: <construct-org.progeeks.meta.ListPropertyType> <ctor.arguments> <org.progeeks.meta.ClassPropertyType _ctor="java.lang.String" /> </ctor.arguments> </construct-org.progeeks.meta.ListPropertyType>

Version:
$Revision: 1.2 $
Author:
Paul Speed

Field Summary
static java.lang.String CONSTRUCT_PREFIX
           
static java.lang.String CONSTRUCTOR_ARGS
           
 
Fields inherited from class org.progeeks.util.xml.BeanConfiguratorHandler
CONFIGURATOR_PREFIX, SINGLETON_PREFIX
 
Fields inherited from class org.progeeks.util.xml.BeanObjectHandler
CONFIG_IMPORT_PACKAGE
 
Constructor Summary
ConstructedBeanHandler()
           
 
Method Summary
 boolean canHandle(java.lang.String tag)
          Returns true if this handler applies to the specified object tag.
 java.lang.Object createObject(java.lang.String tag, org.xml.sax.Attributes atts, ObjectXmlReader reader)
          Creates and returns an object based on the specified parameters.
 java.lang.Class getPropertyClass(java.lang.Object obj, java.lang.String field, ObjectXmlReader reader)
          Overridden to attempt to do a better type lookup when possible.
protected  java.lang.String getUnprefixedName(java.lang.String tag)
          Returns the class name part of a tag (without the prefix) or null if the tag does not contain a prefix.
 java.lang.Object resolveObject(java.lang.String tag, java.lang.Object obj, ObjectXmlReader reader)
          Used the bean configurator to create the actual object with a set of constructor arguments.
 
Methods inherited from class org.progeeks.util.xml.BeanConfiguratorHandler
getPropertyCollection
 
Methods inherited from class org.progeeks.util.xml.BeanObjectHandler
getClass, getClass, getConstant, getInnerClass, getPackages, getProperty, getTagClass, ignoreAttribute, importPackage, setConfigurationProperty, setObjectProperties, setPackages, setProperty, setTextProperty
 
Methods inherited from class org.progeeks.util.xml.AbstractObjectHandler
setContainedText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONSTRUCT_PREFIX

public static final java.lang.String CONSTRUCT_PREFIX
See Also:
Constant Field Values

CONSTRUCTOR_ARGS

public static final java.lang.String CONSTRUCTOR_ARGS
See Also:
Constant Field Values
Constructor Detail

ConstructedBeanHandler

public ConstructedBeanHandler()
Method Detail

getUnprefixedName

protected java.lang.String getUnprefixedName(java.lang.String tag)
Returns the class name part of a tag (without the prefix) or null if the tag does not contain a prefix.

Overrides:
getUnprefixedName in class BeanConfiguratorHandler

canHandle

public boolean canHandle(java.lang.String tag)
Returns true if this handler applies to the specified object tag.

Specified by:
canHandle in interface ObjectHandler
Overrides:
canHandle in class BeanConfiguratorHandler

getPropertyClass

public java.lang.Class getPropertyClass(java.lang.Object obj,
                                        java.lang.String field,
                                        ObjectXmlReader reader)
Overridden to attempt to do a better type lookup when possible. If we're operating on a configurator that actually has its class initialized then we should be able to determine type information at this time... at least in most cases.

Specified by:
getPropertyClass in interface ObjectHandler
Overrides:
getPropertyClass in class BeanConfiguratorHandler

createObject

public java.lang.Object createObject(java.lang.String tag,
                                     org.xml.sax.Attributes atts,
                                     ObjectXmlReader reader)
Creates and returns an object based on the specified parameters.

Specified by:
createObject in interface ObjectHandler
Overrides:
createObject in class BeanConfiguratorHandler

resolveObject

public java.lang.Object resolveObject(java.lang.String tag,
                                      java.lang.Object obj,
                                      ObjectXmlReader reader)
Used the bean configurator to create the actual object with a set of constructor arguments.

Specified by:
resolveObject in interface ObjectHandler
Overrides:
resolveObject in class AbstractObjectHandler


Copyright © 2002-2003 Paul Speed. All Rights Reserved.