Class MetadataParser
java.lang.Object
org.spongepowered.plugin.metadata.builtin.MetadataParser
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddWarning(String warning) Adds a warning generated by a (de)serializer so that the platform may log it later.static Gsongson()static MetadataContainerstatic MetadataContainerstatic MetadataContainerstatic MetadataContainerwarnings()Returns all warnings generated by (de)serializers so that the platform may log them when appropriate.static voidwrite(Writer writer, MetadataContainer container, boolean indent) static voidwrite(Writer writer, MetadataContainer container, Gson gson, boolean indent) static voidwrite(Path path, MetadataContainer container, boolean indent) static voidwrite(Path path, MetadataContainer container, Gson gson, boolean indent)
-
Method Details
-
gson
-
warnings
Returns all warnings generated by (de)serializers so that the platform may log them when appropriate.- Returns:
- The warnings
-
addWarning
Adds a warning generated by a (de)serializer so that the platform may log it later.- Parameters:
warning- The warning
-
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,
gson()is available.- Parameters:
path- The pathgson- The deserializer- Returns:
- The container
- Throws:
IOException- if the container fails to be read
-
read
- 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,
gson()is available.- Parameters:
reader- The readergson- The deserializer- Returns:
- The container
- Throws:
IOException- if the container fails to deserialize
-
write
- Parameters:
path- The pathcontainer- The containerindent- True to indent (pretty print) the resulting JSON, false if not- Throws:
IOException- If the container fails to serialize
-
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,
gson()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, boolean indent) throws IOException - Parameters:
writer- The writercontainer- The containerindent- 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,
gson()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
-