Package net.pottercraft.ollivanders2
Class GsonDAO
java.lang.Object
net.pottercraft.ollivanders2.GsonDAO
- All Implemented Interfaces:
GenericDAO
GSON data persistance layer
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringthe apparate locations save file namestatic final Stringthe house points save file namestatic final Stringthe house points save file namestatic final Stringthe effects save file namestatic final Stringthe players save file namestatic final Stringthe prophecies save file namestatic final Stringthe stationary spell save file name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRead the apparate locations@Nullable Map<O2HouseType, Integer> read the house points json data@Nullable Map<UUID, O2HouseType> Read the house sort data from jsonreadSavedDataListMap(@NotNull String filename) Read a serilized list of maps from json filereadSavedDataMapStringMap(@NotNull String filename) Read a serilaized map of strings and maps from json filevoidwriteApparateData(@NotNull HashMap<String, org.bukkit.Location> locations) Save the apparate locationsvoidwriteHousePoints(@NotNull Map<O2HouseType, Integer> map) Write house pointsvoidwriteHouses(@NotNull Map<UUID, O2HouseType> map) Write the house sort datavoidwriteSaveData(@NotNull HashMap<String, String> map, @NotNull String filename) Write save data serialized in to a hashmap of String, String pairsvoidWrite the prophecies to json filevoidWrite save data serialized in to a map of String, Map pairs
-
Field Details
-
housesJSONFile
the house points save file name- See Also:
-
housePointsJSONFile
the house points save file name- See Also:
-
apparateLocationsJSONFile
the apparate locations save file name- See Also:
-
o2PlayerJSONFile
the players save file name- See Also:
-
o2StationarySpellsJSONFile
the stationary spell save file name- See Also:
-
o2PropheciesJSONFile
the prophecies save file name- See Also:
-
o2EffectsJSONFile
the effects save file name- See Also:
-
-
Constructor Details
-
GsonDAO
public GsonDAO()Constructor
-
-
Method Details
-
writeHouses
Write the house sort data- Specified by:
writeHousesin interfaceGenericDAO- Parameters:
map- a map of player and house data as strings
-
writeHousePoints
Write house points- Specified by:
writeHousePointsin interfaceGenericDAO- Parameters:
map- a map of the house points data as strings
-
writeApparateData
Save the apparate locations- Parameters:
locations- the map of location names to Locations
-
writeSaveData
public void writeSaveData(@NotNull @NotNull HashMap<String, String> map, @NotNull @NotNull String filename) Write save data serialized in to a hashmap of String, String pairs- Specified by:
writeSaveDatain interfaceGenericDAO- Parameters:
map- the map of saved datafilename- the file to write to
-
writeSaveData
public void writeSaveData(@NotNull @NotNull Map<String, Map<String, String>> map, @NotNull @NotNull String filename) Write save data serialized in to a map of String, Map pairs- Specified by:
writeSaveDatain interfaceGenericDAO- Parameters:
map- a map of the player data as stringsfilename- the name of the output stream
-
writeSaveData
public void writeSaveData(@NotNull @NotNull List<Map<String, String>> map, @NotNull @NotNull String filename) Write the prophecies to json file- Specified by:
writeSaveDatain interfaceGenericDAO- Parameters:
map- a map of prophecy data as stringsfilename- the name of the output stream
-
readHouses
Read the house sort data from json- Specified by:
readHousesin interfaceGenericDAO- Returns:
- a map of player UUIDs and their house
-
readHousePoints
read the house points json data- Specified by:
readHousePointsin interfaceGenericDAO- Returns:
- a map of houses and their points
-
readApparateLocation
Read the apparate locations- Returns:
- a map of apparate locations or null if load failed
-
readSavedDataMapStringMap
@Nullable public @Nullable Map<String,Map<String, readSavedDataMapStringMapString>> (@NotNull @NotNull String filename) Read a serilaized map of strings and maps from json file- Specified by:
readSavedDataMapStringMapin interfaceGenericDAO- Parameters:
filename- the input stream to read- Returns:
- a map of the player json data
-
readSavedDataListMap
@Nullable public @Nullable List<Map<String,String>> readSavedDataListMap(@NotNull @NotNull String filename) Read a serilized list of maps from json file- Specified by:
readSavedDataListMapin interfaceGenericDAO- Parameters:
filename- the input stream to read- Returns:
- a list of the serialized stationary spells
-