Interface TypeSerializer<T>
-
- Type Parameters:
T
- The type
- All Known Implementing Classes:
ScalarSerializer
public interface TypeSerializer<T>
Represents an object which can serialize and deserialize objects of a given type.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable T
deserialize(@NonNull TypeToken<?> type, @NonNull ConfigurationNode value)
Deserialize an object (of the correct type) from the given configuration node.void
serialize(@NonNull TypeToken<?> type, @Nullable T obj, @NonNull ConfigurationNode value)
Serialize an object to the given configuration node.
-
-
-
Method Detail
-
deserialize
@Nullable T deserialize(@NonNull TypeToken<?> type, @NonNull ConfigurationNode value) throws ObjectMappingException
Deserialize an object (of the correct type) from the given configuration node.- Parameters:
type
- The type of return value requiredvalue
- The node containing serialized data- Returns:
- An object
- Throws:
ObjectMappingException
- If the presented data is invalid
-
serialize
void serialize(@NonNull TypeToken<?> type, @Nullable T obj, @NonNull ConfigurationNode value) throws ObjectMappingException
Serialize an object to the given configuration node.- Parameters:
type
- The type of the input objectobj
- The object to be serializedvalue
- The node to write to- Throws:
ObjectMappingException
- If the object cannot be serialized
-
-