org.cybertory.MSS
Class XMLHandlerAtomic

java.lang.Object
  extended byorg.cybertory.MSS.XMLHandler
      extended byorg.cybertory.MSS.XMLHandlerAtomic
All Implemented Interfaces:
java.lang.Comparable

public class XMLHandlerAtomic
extends XMLHandler

One class that can serve for XMLHandler instances for all of: primitive types (int, float, boolean, etc.) and their object equivalents (Integer, Float, ... Boolean) and String as well as arrays of any of those things.


Field Summary
 
Fields inherited from class org.cybertory.MSS.XMLHandler
handledClass
 
Constructor Summary
XMLHandlerAtomic(java.lang.Class dataType)
           
 
Method Summary
protected  boolean allowBackwardRef()
          Allow multiple elements for this data type ?
protected  boolean allowMultiple()
           
protected static boolean canInstantiate(java.lang.Class cls)
           
protected  boolean needsTypedef()
          Allow data in the "defs" section, with later backward references ?
protected  java.lang.Object parseElement(org.jdom.Element elem, XMLAltData altData)
          Given that the element already extracted from it's context, parse the data (whose type should match that of the handler).
 org.jdom.Element schemaTypedef()
          Generate Schema type definition for the class (using JDOM).
 java.lang.String xmlTypeName()
          Return the label to be used in the name of schema type defs.
 
Methods inherited from class org.cybertory.MSS.XMLHandler
alternateElement, compareTo, extractChildren, getAllHandlers, getHandledClasses, getHandler, getHandlersDefs, getXMLChildFilter, getXMLChildFilter, handledClass, handlersReport, parseChildren, parseRequest, parseXMLDocument, schemaDocument, schemaInContext, schemaInContext, schemaInContext, schemaInContext, typeDescription
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLHandlerAtomic

public XMLHandlerAtomic(java.lang.Class dataType)
                 throws XMLUnhandledTypeException
Method Detail

canInstantiate

protected static boolean canInstantiate(java.lang.Class cls)

schemaTypedef

public org.jdom.Element schemaTypedef()
                               throws XMLUnhandledTypeException
Generate Schema type definition for the class (using JDOM). In this case, it's only schema lists used for array data types.

Overrides:
schemaTypedef in class XMLHandler
Returns:
a JDOM Element with schema for type
Throws:
XMLUnhandledTypeException

parseElement

protected java.lang.Object parseElement(org.jdom.Element elem,
                                        XMLAltData altData)
                                 throws XMLParseException
Description copied from class: XMLHandler
Given that the element already extracted from it's context, parse the data (whose type should match that of the handler).

Specified by:
parseElement in class XMLHandler
Parameters:
elem - the JDOM element containing the data
altData - the background data context for parsing
Returns:
an object of the appropriate type
Throws:
XMLParseException

allowMultiple

protected boolean allowMultiple()
Specified by:
allowMultiple in class XMLHandler

allowBackwardRef

protected boolean allowBackwardRef()
Allow multiple elements for this data type ?

Specified by:
allowBackwardRef in class XMLHandler

needsTypedef

protected boolean needsTypedef()
Allow data in the "defs" section, with later backward references ?

Specified by:
needsTypedef in class XMLHandler

xmlTypeName

public java.lang.String xmlTypeName()
Description copied from class: XMLHandler
Return the label to be used in the name of schema type defs.

Specified by:
xmlTypeName in class XMLHandler
Returns:
schema type label (or null if no data type name is to be used)