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 V
deserialize
(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 Object
serialize
(AnnotatedType type, V item, Predicate<Class<?>> typeSupported) Serialize the provided value to a supported type, testing against the provided predicate.protected Object
Serialize 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, type
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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.type
must 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:ScalarSerializer
Given an object of unknown type, attempt to convert it into the given type.- Overrides:
deserialize
in 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:ScalarSerializer
Given an object of unknown type, attempt to convert it into the given type.- Specified by:
deserialize
in 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:ScalarSerializer
Serialize the provided value to a supported type, testing against the provided predicate.Annotated type information is provided for reference.
- Overrides:
serialize
in 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:ScalarSerializer
Serialize the provided value to a supported type, testing against the provided predicate.- Specified by:
serialize
in classScalarSerializer<V>
- Parameters:
item
- the value to serializetypeSupported
- a predicate to allow choosing which types are supported- Returns:
- a serialized form of this object
-