Class MetadataParser
java.lang.Object
org.spongepowered.plugin.metadata.builtin.MetadataParser
-
Method Summary
Modifier and TypeMethodDescriptionstatic GsonBuilder
static MetadataContainer
Reads acontainer
from a givenreader
using the defaultdeserializer
(retrieved fromgsonBuilder()
).static MetadataContainer
static MetadataContainer
static MetadataContainer
static void
write
(Writer writer, MetadataContainer container, Gson gson, boolean indent) static void
write
(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 acontainer
from a givenpath
with 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 acontainer
from a givenreader
using the defaultdeserializer
(retrieved fromgsonBuilder()
).- Parameters:
reader
- The reader- Returns:
- The container
- Throws:
IOException
- if the container fails to be read
-
read
Reads acontainer
from a givenreader
with 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 acontainer
to the givenpath
using 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 acontainer
to the givenpath
using 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
-