Class ScalarSerializer.Annotated<V>
java.lang.Object
org.spongepowered.configurate.serialize.ScalarSerializer<V>
org.spongepowered.configurate.serialize.ScalarSerializer.Annotated<V>
- Type Parameters:
V- the value to deserialize
- All Implemented Interfaces:
TypeSerializer<V>,TypeSerializer.Annotated<V>
- Enclosing class:
- ScalarSerializer<T>
A specialization of the scalar serializer that favors
annotated type methods over unannotated methods.
- Since:
- 4.2.0
-
Nested Class Summary
Nested classes/interfaces inherited from class org.spongepowered.configurate.serialize.ScalarSerializer
ScalarSerializer.Annotated<V> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Vdeserialize(AnnotatedType type, Object obj) Given an object of unknown type, attempt to convert it into the given type.deserialize(Type type, Object obj) Given an object of unknown type, attempt to convert it into the given type.protected abstract Objectserialize(AnnotatedType type, V item, Predicate<Class<?>> typeSupported) Serialize the provided value to a supported type, testing against the provided predicate.protected ObjectSerialize the provided value to a supported type, testing against the provided predicate.Methods inherited from class org.spongepowered.configurate.serialize.ScalarSerializer
deserialize, deserialize, deserialize, serialize, serialize, serializeToString, tryDeserialize, typeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.spongepowered.configurate.serialize.TypeSerializer.Annotated
emptyValue, emptyValue
-
Constructor Details
-
Annotated
Create a new annotated scalar serializer that handles the provided type.typemust not be a raw parameterized type.- Parameters:
type- type to handle- Since:
- 4.2.0
-
Annotated
Create a new annotated scalar serializer that handles the provided type.- Parameters:
type- type to handle- Since:
- 4.2.0
-
-
Method Details
-
deserialize
Description copied from class:ScalarSerializerGiven an object of unknown type, attempt to convert it into the given type.- Overrides:
deserializein classScalarSerializer<V>- Parameters:
type- the specific type of the type's usageobj- the object to convert- Returns:
- a converted object
- Throws:
SerializationException- if the object could not be converted for any reason
-
deserialize
Description copied from class:ScalarSerializerGiven an object of unknown type, attempt to convert it into the given type.- Specified by:
deserializein classScalarSerializer<V>- Parameters:
type- the specific type of the type's usageobj- the object to convert- Returns:
- a converted object
- Throws:
SerializationException- if the object could not be converted for any reason
-
serialize
Description copied from class:ScalarSerializerSerialize the provided value to a supported type, testing against the provided predicate.Annotated type information is provided for reference.
- Overrides:
serializein classScalarSerializer<V>- Parameters:
type- the annotated type of the field being serializeditem- the value to serializetypeSupported- a predicate to allow choosing which types are supported- Returns:
- a serialized form of this object
-
serialize
Description copied from class:ScalarSerializerSerialize the provided value to a supported type, testing against the provided predicate.- Specified by:
serializein classScalarSerializer<V>- Parameters:
item- the value to serializetypeSupported- a predicate to allow choosing which types are supported- Returns:
- a serialized form of this object
-