Package net.handle.hdllib
Class GsonUtility
- java.lang.Object
 - 
- net.handle.hdllib.GsonUtility
 
 
- 
public class GsonUtility extends java.lang.Object 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGsonUtility.AdminRecordGsonTypeAdapterstatic classGsonUtility.HandleValueGsonTypeAdapterstatic classGsonUtility.InterfaceGsonTypeAdapterstatic classGsonUtility.PrivateKeyTypeHierarchyAdapterstatic classGsonUtility.PublicKeyTypeHierarchyAdapterstatic classGsonUtility.ResponseGsonTypeHierarchyAdapterstatic classGsonUtility.ServerInfoGsonTypeAdapterstatic classGsonUtility.SiteInfoGsonTypeAdapterstatic classGsonUtility.TransactionGsonTypeAdapterstatic classGsonUtility.ValueReferenceGsonTypeAdapter 
- 
Constructor Summary
Constructors Constructor Description GsonUtility() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.google.gson.GsongetGson()Returns a Gson instance which can serialize and deserialize various Handle.net types.static com.google.gson.GsonBuildergetNewGsonBuilder()Returns a GsonBuilder which can serialize and deserialize various Handle.net types.static com.google.gson.GsongetPrettyGson()Returns a Gson instance which can serialize and deserialize various Handle.net types.static com.google.gson.JsonElementserializeResponseToRequest(AbstractRequest req, AbstractResponse resp)Serialize a response, adding in the handle value from the given request.static com.google.gson.GsonBuildersetup(com.google.gson.GsonBuilder gsonBuilder)Register Handle.net type adapters on a given GsonBuilder, to enable serialization and deserialization of various Handle.net types. 
 - 
 
- 
- 
Method Detail
- 
setup
public static com.google.gson.GsonBuilder setup(com.google.gson.GsonBuilder gsonBuilder)
Register Handle.net type adapters on a given GsonBuilder, to enable serialization and deserialization of various Handle.net types.- Parameters:
 gsonBuilder- a GsonBuilder- Returns:
 - the passed-in GsonBuilder.
 
 
- 
getNewGsonBuilder
public static com.google.gson.GsonBuilder getNewGsonBuilder()
Returns a GsonBuilder which can serialize and deserialize various Handle.net types.- Returns:
 - a GsonBuilder which can serialize and deserialize various Handle.net types.
 
 
- 
getGson
public static com.google.gson.Gson getGson()
Returns a Gson instance which can serialize and deserialize various Handle.net types. This Gson instance has HTML escaping disabled.- Returns:
 - a Gson instance which can serialize and deserialize various Handle.net types.
 
 
- 
getPrettyGson
public static com.google.gson.Gson getPrettyGson()
Returns a Gson instance which can serialize and deserialize various Handle.net types. This Gson instance has HTML escaping disabled and pretty-printing enabled.- Returns:
 - a Gson instance which can serialize and deserialize various Handle.net types.
 
 
- 
serializeResponseToRequest
public static com.google.gson.JsonElement serializeResponseToRequest(AbstractRequest req, AbstractResponse resp)
Serialize a response, adding in the handle value from the given request.- Parameters:
 req- a requestresp- a response- Returns:
 - The response, serialized as a JSON tree, with the "handle" value from the request if not already in the response.
 
 
 - 
 
 -