de.hpi.fgis.dude.util.data.json.auto
Class Primitive<T>

java.lang.Object
  extended by de.hpi.fgis.dude.util.data.json.auto.Primitive<T>
Type Parameters:
T - the primitive type or boxing class

public abstract class Primitive<T>
extends Object

Json serialization for basic types including primitive types and boxing classes as well as Strings.

Author:
Arvid.Heise

Constructor Summary
protected Primitive(Class<T> type)
          Initializes the primitive for given type
 
Method Summary
 Class<T> getType()
          Returns the type of the primitive
(package private) abstract  T read(DuDeJsonParser<?> parser)
          Reads the next value from the parser and returns it.
(package private) abstract  void write(T object, DuDeJsonGenerator generator)
          Writes the given primitive to the json stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Primitive

protected Primitive(Class<T> type)
Initializes the primitive for given type

Parameters:
type -
Method Detail

getType

public Class<T> getType()
Returns the type of the primitive

Returns:
type of the primitive

read

abstract T read(DuDeJsonParser<?> parser)
         throws org.codehaus.jackson.JsonParseException,
                IOException
Reads the next value from the parser and returns it.

Parameters:
parser - the parser
Returns:
an instance of getType()
Throws:
org.codehaus.jackson.JsonParseException - If an error occurred while parsing the data.
IOException - If an error occurred while reading from the stream.

write

abstract void write(T object,
                    DuDeJsonGenerator generator)
             throws org.codehaus.jackson.JsonGenerationException,
                    IOException
Writes the given primitive to the json stream.

Parameters:
object - the object to write
generator - the DuDeJsonGenerator rendering the passed value to json
Throws:
org.codehaus.jackson.JsonGenerationException - If an error occurs while generating the Json syntax.
IOException - If an error occurs while accessing the underlying stream.


Copyright © 2011 Hasso Plattner Institute - Chair of Information Systems. All Rights Reserved.