Class MetadataParser
java.lang.Object
org.spongepowered.plugin.metadata.builtin.MetadataParser
-
Method Summary
Modifier and TypeMethodDescriptionstatic GsonBuilderstatic MetadataContainerReads acontainerfrom a givenreaderusing the defaultdeserializer(retrieved fromgsonBuilder()).static MetadataContainerstatic MetadataContainerstatic MetadataContainerstatic voidwrite(Writer writer, MetadataContainer container, Gson gson, boolean indent) static voidwrite(Path path, MetadataContainer container, Gson gson, boolean indent)
-
Method Details
-
gsonBuilder
-
read
- Parameters:
path- The path- Returns:
- The container
- Throws:
IOException- if the container fails to be read
-
read
Reads acontainerfrom a givenpathwith configureddeserializer.To get a standard deserializer,
gsonBuilder()is available.- Parameters:
path- The pathgson- The deserializer- Returns:
- The container
- Throws:
IOException- if the container fails to be read
-
read
Reads acontainerfrom a givenreaderusing the defaultdeserializer(retrieved fromgsonBuilder()).- Parameters:
reader- The reader- Returns:
- The container
- Throws:
IOException- if the container fails to be read
-
read
Reads acontainerfrom a givenreaderwith configureddeserializer.To get a standard deserializer,
gsonBuilder()is available.- Parameters:
reader- The readergson- The deserializer- Returns:
- The container
- Throws:
IOException- if the container fails to deserialize
-
write
public static void write(Path path, MetadataContainer container, Gson gson, boolean indent) throws IOException Writes acontainerto the givenpathusing the configuredserializer.To get a standard serializer,
gsonBuilder()is available.- Parameters:
path- The pathcontainer- The containergson- The serializerindent- True to indent (pretty print) the resulting JSON, false if not- Throws:
IOException- If the container fails to serialize
-
write
public static void write(Writer writer, MetadataContainer container, Gson gson, boolean indent) throws IOException Writes acontainerto the givenpathusing the configuredserializer.To get a standard serializer,
gsonBuilder()is available.- Parameters:
writer- The writercontainer- The containergson- The serializerindent- True to indent (pretty print) the resulting JSON, false if not- Throws:
IOException- If the container fails to serialize
-