public class JSONHelper extends Object
Modifier and Type | Class and Description |
---|---|
static class |
JSONHelper.BroadWorksServerPostProcessor |
static class |
JSONHelper.OptionalTypeAdapter
A handler for serialization and deserialization of Optionals.
|
static class |
JSONHelper.PolymorphicDeserializer<T>
Deserializer Class for SuperTypes.
|
Constructor and Description |
---|
JSONHelper() |
Modifier and Type | Method and Description |
---|---|
static com.google.gson.Gson |
getDeserializerGSON(BroadWorksServer broadWorksServer)
Retrieves a deserializer GSON object for standard deserialization of JSON to Alpaca Objects
|
static com.google.gson.Gson |
getDeserializerGSON(BroadWorksServer broadWorksServer,
String sourceDefaultDomain,
boolean convertDefaultDomain)
Retrieves a deserializer GSON object for standard deserialization of JSON to Alpaca Objects
|
static com.google.gson.Gson |
getSerializerGSON()
Retrieves a serializer GSON object for standard creation of JSON from Alpaca Objects
|
static <T extends BroadWorksObjectInformation> |
inputBroadWorksInformation(Type type,
FileReader fileReader,
BroadWorksServer broadWorksServer)
Imports a BroadWorksObjectInformation class from the specified File
|
static <T extends BroadWorksObjectInformation> |
outputBroadWorksInformation(T information,
FileWriter fileWriter)
Outputs a BroadWorksObjectInformation class as JSON to the specified
FileOutputStream
|
public static com.google.gson.Gson getSerializerGSON()
public static com.google.gson.Gson getDeserializerGSON(BroadWorksServer broadWorksServer, String sourceDefaultDomain, boolean convertDefaultDomain) throws HelperException
broadWorksServer
- The BroadWorksServer to deserialize into.sourceDefaultDomain
- The SourceDefault domain if conversion is not expectedconvertDefaultDomain
- Flag to convert the deserialized information to the new default domain of the provided BroadWorksServerHelperException
- Thrown if the BroadWorksServer or SourceDefaultDomain is nullpublic static com.google.gson.Gson getDeserializerGSON(BroadWorksServer broadWorksServer) throws HelperException
broadWorksServer
- The BroadWorksServer to deserialize into.HelperException
public static <T extends BroadWorksObjectInformation> void outputBroadWorksInformation(T information, FileWriter fileWriter) throws HelperException
T
- The Information typeinformation
- The input informationfileWriter
- The output stream for the generated JSONHelperException
- Throw if an error occurs while outputting the information.public static <T extends BroadWorksObjectInformation> T inputBroadWorksInformation(Type type, FileReader fileReader, BroadWorksServer broadWorksServer) throws HelperException
T
- The Information typetype
- The Information typefileReader
- The file reader for the JSON objectbroadWorksServer
- The BroadWorksServer to deserialize into.HelperException
- Throw if an error occurs on input.Copyright © 2017 ECG. All rights reserved.