- All Implemented Interfaces:
WorldIo
@NullMarked
public class JsonWorldIo
extends Object
implements WorldIo
A reflection free JSON implementation of
WorldIo
.
-
Constructor Summary
Constructors
Creates a new JsonWorldIo instance with desired JsonMapper
s.
-
Method Summary
Deserializes a string into a
World
.
Serializes a
World
into a string.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
JsonWorldIo
public JsonWorldIo(List<technology.sola.json.mapper.JsonMapper<? extends Component>> componentJsonMappers)
Creates a new JsonWorldIo instance with desired JsonMapper
s.
- Parameters:
componentJsonMappers
- the JsonMapper
s to be used during serialization and deserialization
-
Method Details
-
stringify
Description copied from interface: WorldIo
Serializes a
World
into a string.
- Specified by:
stringify
in interface WorldIo
- Parameters:
world
- the World
to serialize
- Returns:
- the serialized
World
-
parse
Description copied from interface: WorldIo
Deserializes a string into a
World
.
- Specified by:
parse
in interface WorldIo
- Parameters:
worldString
- the string to deserialize
- Returns:
- the deserialized
World