org.progeeks.graph.xml
Class GraphObjectHandler

java.lang.Object
  extended by org.progeeks.util.xml.AbstractObjectHandler
      extended by org.progeeks.util.xml.BeanObjectHandler
          extended by org.progeeks.util.xml.DefaultObjectHandler
              extended by org.progeeks.graph.xml.GraphObjectHandler
All Implemented Interfaces:
ObjectHandler

public class GraphObjectHandler
extends DefaultObjectHandler

An ObjectXmlReader object handler capable of reading most Plexus Graphs from a specifically formatted XML file. For the most part this treats the Graph like a bean, but certain fields (such as "edges" and "nodes" have significant meaning to this handler and do not directly relate to bean setters.

Version:
$Revision: 1.8 $
Author:
Paul Speed

Nested Class Summary
static class GraphObjectHandler.EdgeHolder
           
 
Field Summary
 
Fields inherited from class org.progeeks.util.xml.BeanObjectHandler
CONFIG_IMPORT_PACKAGE
 
Constructor Summary
GraphObjectHandler()
           
 
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.
 boolean getHandleAllGraphs()
          Returns true if the handler will handle any com.phoenixt.plexus.Graph implementations.
 java.lang.Class getPropertyClass(java.lang.Object obj, java.lang.String field, ObjectXmlReader reader)
          Returns the base type for the specified field.
 java.util.Collection getPropertyCollection(java.lang.Object obj, java.lang.String field, ObjectXmlReader reader)
          Returns the a collection for the specified field that can be used to accumulate multiple object values.
protected  boolean ignoreAttribute(java.lang.String name, ObjectXmlReader reader)
          A convenient place for subclasses to override attribute ignore behavior.
 void setHandleAllGraphs(boolean flag)
          Set to true for the handler to handle any com.phoenixt.plexus.Graph implementations.
 void setProperty(java.lang.Object obj, java.lang.String field, java.lang.Object value, ObjectXmlReader reader)
          Sets a property on the specified object.
 
Methods inherited from class org.progeeks.util.xml.DefaultObjectHandler
addHandledClass, getHandledClasses
 
Methods inherited from class org.progeeks.util.xml.BeanObjectHandler
getClass, getClass, getConstant, getInnerClass, getPackages, getProperty, getTagClass, importPackage, setConfigurationProperty, setObjectProperties, setPackages, 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
 

Constructor Detail

GraphObjectHandler

public GraphObjectHandler()
Method Detail

setHandleAllGraphs

public void setHandleAllGraphs(boolean flag)
Set to true for the handler to handle any com.phoenixt.plexus.Graph implementations. In many ways, this overrides the normal functioning of the canHandle() method.


getHandleAllGraphs

public boolean getHandleAllGraphs()
Returns true if the handler will handle any com.phoenixt.plexus.Graph implementations.


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 DefaultObjectHandler

setProperty

public void setProperty(java.lang.Object obj,
                        java.lang.String field,
                        java.lang.Object value,
                        ObjectXmlReader reader)
Sets a property on the specified object. Does special processing for the "nodes" and "edges" fields.

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

getPropertyClass

public java.lang.Class getPropertyClass(java.lang.Object obj,
                                        java.lang.String field,
                                        ObjectXmlReader reader)
Returns the base type for the specified field. Does special processing for the "nodes" and "edges" fields.

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)
Returns the a collection for the specified field that can be used to accumulate multiple object values. This is used when the XML field declaration specifies the progressive attribute.

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

ignoreAttribute

protected boolean ignoreAttribute(java.lang.String name,
                                  ObjectXmlReader reader)
Description copied from class: BeanObjectHandler
A convenient place for subclasses to override attribute ignore behavior.

Overrides:
ignoreAttribute 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.