org.progeeks.util.xml
Class BeanConfiguratorHandler

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

public class BeanConfiguratorHandler
extends BeanObjectHandler

Object handler that allows easier specification bean configurators since it will intercept a "factory-foo" style tag and create the appropriate beanConfigurator without having to pass a fully qualified class name in a _ctor="" attribute.

Version:
$Revision: 1.9 $
Author:
Paul Speed

Field Summary
static java.lang.String CONFIGURATOR_PREFIX
           
static java.lang.String SINGLETON_PREFIX
           
 
Fields inherited from class org.progeeks.util.xml.BeanObjectHandler
CONFIG_IMPORT_PACKAGE
 
Constructor Summary
BeanConfiguratorHandler()
           
 
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.
 java.util.Collection getPropertyCollection(java.lang.Object obj, java.lang.String field, ObjectXmlReader reader)
          Overridden to provide saner error messages when the user attempts to use the progressive="true" for factory fields.
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.
 
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
resolveObject, setContainedText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIGURATOR_PREFIX

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

SINGLETON_PREFIX

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

BeanConfiguratorHandler

public BeanConfiguratorHandler()
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.


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 BeanObjectHandler

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 BeanObjectHandler

getPropertyCollection

public java.util.Collection getPropertyCollection(java.lang.Object obj,
                                                  java.lang.String field,
                                                  ObjectXmlReader reader)
Overridden to provide saner error messages when the user attempts to use the progressive="true" for factory fields.

Specified by:
getPropertyCollection in interface ObjectHandler
Overrides:
getPropertyCollection in class BeanObjectHandler

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 BeanObjectHandler


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