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
Modifier and Type Method Description @Nullable Tdeserialize(@NonNull TypeToken<?> type, @NonNull ConfigurationNode value)Deserialize an object (of the correct type) from the given configuration node.voidserialize(@NonNull TypeToken<?> type, @Nullable T obj, @NonNull ConfigurationNode value)Serialize an object to the given configuration node.
-
Method Details
-
deserialize
@Nullable T deserialize(@NonNull TypeToken<?> type, @NonNull ConfigurationNode value) throws ObjectMappingExceptionDeserialize 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 ObjectMappingExceptionSerialize 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
-