common-util

local.tomas.common.xml.impl
Class EnumTypeHandler

java.lang.Object
  extended by local.tomas.common.xml.XMLTypeHandler
      extended by local.tomas.common.xml.impl.EnumTypeHandler

public class EnumTypeHandler
extends XMLTypeHandler

Type handler for enumerations.

Author:
Teubner

Field Summary
 
Fields inherited from class local.tomas.common.xml.XMLTypeHandler
arrayType, arrayTypeHandler, name, type
 
Constructor Summary
EnumTypeHandler()
          Default constructor.
 
Method Summary
protected  int getArraySize(Object src)
          Get size of array.
protected  void marshallArrayElements(Class type, Object src, XMLTokenGenerator gen)
          Generate XML description of array elements.
protected  void marshallValue(Class type, Object src, XMLTokenGenerator gen)
          Generate XML description of object value.
 Object newInstance(Class<?> type, String value)
          Create an instance of the type handled initialized with a string value.
protected  void setArrayElement(Object dest, int index, Object value)
          Set array component.
 
Methods inherited from class local.tomas.common.xml.XMLTypeHandler
getArrayType, getArrayTypeHandler, getName, getType, marshall, marshall, marshallNullPrefix, marshallNullSuffix, marshallPrefix, marshallRef, marshallSuffix, match, newArray, newInstance, newInstance, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumTypeHandler

public EnumTypeHandler()
Default constructor.

Method Detail

marshallValue

protected void marshallValue(Class type,
                             Object src,
                             XMLTokenGenerator gen)
                      throws XMLException
Description copied from class: XMLTypeHandler
Generate XML description of object value.

Specified by:
marshallValue in class XMLTypeHandler
Parameters:
type - - object type
src - - the object
gen - - used to generate XML tokens
Throws:
XMLException

getArraySize

protected int getArraySize(Object src)
Description copied from class: XMLTypeHandler
Get size of array.

Specified by:
getArraySize in class XMLTypeHandler
Parameters:
src - - the array
Returns:
the size

marshallArrayElements

protected void marshallArrayElements(Class type,
                                     Object src,
                                     XMLTokenGenerator gen)
                              throws XMLException
Description copied from class: XMLTypeHandler
Generate XML description of array elements.

Specified by:
marshallArrayElements in class XMLTypeHandler
Parameters:
type - - the array type
src - - the array
gen - - used to generate XML tokens
Throws:
XMLException

setArrayElement

protected void setArrayElement(Object dest,
                               int index,
                               Object value)
                        throws XMLException
Description copied from class: XMLTypeHandler
Set array component.

Specified by:
setArrayElement in class XMLTypeHandler
Parameters:
dest - - the array
index - - the index within the array
value - - the value to assign
Throws:
XMLException

newInstance

public Object newInstance(Class<?> type,
                          String value)
                   throws XMLException
Description copied from class: XMLTypeHandler
Create an instance of the type handled initialized with a string value.

Overrides:
newInstance in class XMLTypeHandler
Parameters:
type - - type of instance
value - - the string value
Returns:
the instance
Throws:
XMLException

common-util

Copyright © 2007 null. All Rights Reserved.