public interface YamlSerializer
| Modifier and Type | Method and Description |
|---|---|
Object |
deserialize(Map<Object,Object> map)
Attempts to deserialize the given map into a class instance using this serializer.
|
Set<Class<?>> |
getSupportedClasses()
Returns a set of all explicitly defined classes this serializer supports and can (de-)serialize.
|
Set<Class<?>> |
getSupportedParentClasses()
Returns a set of all parent classes (classes, interfaces...) instances of which this serializer supports and can
(de-)serialize.
|
<T> Map<Object,Object> |
serialize(T object,
MapSupplier supplier)
Attempts to serialize the given object into a map and returns it.
|
@Nullable Object deserialize(@NotNull Map<Object,Object> map)
The given map is a raw object map - there are no Block instances, just the values themselves.
If the serializer does not recognize the map, or could not deserialize the map, this method must return
null.
map - the raw map to deserialize@Nullable <T> Map<Object,Object> serialize(@NotNull T object, @NotNull MapSupplier supplier)
The given object is guaranteed to be:
getSupportedClasses(),getSupportedParentClasses().GeneralSettings.getDefaultMapSupplier().
Serializers should not use their own map implementations, they should return the map provided by the supplier.
If could not serialize into a map, this method must return null.
T - type of the object to serializeobject - the object to serializesupplier - the supplier used to supply default maps@NotNull Set<Class<?>> getSupportedClasses()
The returned set cannot be null as indicated by the annotation.
@NotNull Set<Class<?>> getSupportedParentClasses()
The returned set cannot be null as indicated by the annotation.
Copyright © 2022. All rights reserved.