net.contextfw.web.application.converter
Class AttributeJsonSerializer<S>

java.lang.Object
  extended by net.contextfw.web.application.converter.AttributeJsonSerializer<S>
Type Parameters:
S - Type of source
All Implemented Interfaces:
com.google.gson.JsonDeserializer<S>, com.google.gson.JsonSerializer<S>, AttributeSerializer<S>

public abstract class AttributeJsonSerializer<S>
extends Object
implements com.google.gson.JsonDeserializer<S>, com.google.gson.JsonSerializer<S>, AttributeSerializer<S>

A convinience class to handle attribute and Json serialization at the same time

This class can be used to do all serialization for attributes and json, if the serialization method is the same.


Constructor Summary
AttributeJsonSerializer()
           
 
Method Summary
 S deserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context)
           
abstract  S deserialize(String serialized)
           
abstract  String serialize(S source)
           
 com.google.gson.JsonElement serialize(S source, Type typeOfSrc, com.google.gson.JsonSerializationContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeJsonSerializer

public AttributeJsonSerializer()
Method Detail

serialize

public abstract String serialize(S source)
Specified by:
serialize in interface AttributeSerializer<S>

deserialize

public abstract S deserialize(String serialized)

serialize

public com.google.gson.JsonElement serialize(S source,
                                             Type typeOfSrc,
                                             com.google.gson.JsonSerializationContext context)
Specified by:
serialize in interface com.google.gson.JsonSerializer<S>

deserialize

public S deserialize(com.google.gson.JsonElement json,
                     Type typeOfT,
                     com.google.gson.JsonDeserializationContext context)
              throws com.google.gson.JsonParseException
Specified by:
deserialize in interface com.google.gson.JsonDeserializer<S>
Throws:
com.google.gson.JsonParseException


Copyright © 2011. All Rights Reserved.