Package it.polimi.ingsw.utility
Class GSON
java.lang.Object
it.polimi.ingsw.utility.GSON
public final class GSON
extends java.lang.Object
Contains all the possible method used to parse to and from a json string.
Can be used for loading configuration files or for sending and receiving messages to and from the network
-
Method Summary
Modifier and Type Method Description static ActionbuildAction(java.lang.String payload)constructs an ACTION from the given JSON payloadstatic DevelopCardDeckcardParser()construct and setup a DevelopCardDeck class from a JSON config filestatic com.google.gson.GsongetGsonBuilder()Static method to obtain a GsonBuilder with the necessary modifiers enebledstatic LeaderCardDeckleaderCardParser()construct and setup LeaderCardDeck class from a JSON config filestatic LorenzoTracklorenzoTrackParser()construct LorenzoTrack class from a JSON config filestatic TracktrackParser()construct track class from a JSON config fileMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
getGsonBuilder
public static com.google.gson.Gson getGsonBuilder()Static method to obtain a GsonBuilder with the necessary modifiers enebled- Returns:
- the gsonBuilder
-
cardParser
construct and setup a DevelopCardDeck class from a JSON config file- Returns:
- the constructed DevelopCardDeck
- Throws:
java.io.IOException- if it is unable to read the configuration file
-
trackParser
construct track class from a JSON config file- Returns:
- the constructed Track
- Throws:
java.io.IOException- if it is unable to read the configuration file
-
lorenzoTrackParser
construct LorenzoTrack class from a JSON config file- Returns:
- the constructed LorenzoTrack
- Throws:
java.io.IOException- if it is unable to read the configuration file
-
leaderCardParser
construct and setup LeaderCardDeck class from a JSON config file- Returns:
- the constructed LeaderCardDeck
- Throws:
java.io.IOException- if it is unable to read the configuration file
-
buildAction
constructs an ACTION from the given JSON payload- Parameters:
payload- JSON representation of the ACTION to be constructed- Returns:
- the newly created action
-