Class TypeSerializerCollection
- java.lang.Object
-
- ninja.leaping.configurate.objectmapping.serialize.TypeSerializerCollection
-
public class TypeSerializerCollection extends Object
A calculated collection ofTypeSerializer
s
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static TypeSerializerCollection
create()
static TypeSerializerCollection
defaults()
Gets the defaultTypeSerializer
s.<T> TypeSerializer<T>
get(TypeToken<T> type)
TypeSerializerCollection
newChild()
<T> TypeSerializerCollection
register(TypeToken<T> type, TypeSerializer<? super T> serializer)
Register a type serializer for a given type.<T> TypeSerializerCollection
register(Predicate<TypeToken<T>> test, TypeSerializer<? super T> serializer)
Register a type serializer matching against a given predicate.<T> TypeSerializerCollection
register(ScalarSerializer<T> serializer)
Register a scalar serializer under its appropriate type.<T> TypeSerializerCollection
registerPredicate(Predicate<TypeToken<T>> test, TypeSerializer<? super T> serializer)
Deprecated.Useregister(Predicate, TypeSerializer)
instead<T> TypeSerializerCollection
registerType(TypeToken<T> type, TypeSerializer<? super T> serializer)
Deprecated.Use #register(TypeToken, TypeSerializer) instead
-
-
-
Method Detail
-
defaults
public static TypeSerializerCollection defaults()
Gets the defaultTypeSerializer
s. While this collection is mutable, starting with Configurate 4.0 type serializer collections will be immutable, so mutability should not be relied on. Instead, a new child of this collection should be used to register any custom serializers.- Returns:
- The default serializers
-
create
public static TypeSerializerCollection create()
-
get
public <T> TypeSerializer<T> get(TypeToken<T> type)
-
registerType
@Deprecated public <T> TypeSerializerCollection registerType(TypeToken<T> type, TypeSerializer<? super T> serializer)
Deprecated.Use #register(TypeToken, TypeSerializer) insteadRegister a type serializer for a given type. Serializers registered will match all subclasses of the provided type, as well as unwrapped primitive equivalents of the type.- Type Parameters:
T
- The type to generify around- Parameters:
type
- The type to acceptserializer
- The serializer that will be serialized with- Returns:
- this
-
register
public <T> TypeSerializerCollection register(TypeToken<T> type, TypeSerializer<? super T> serializer)
Register a type serializer for a given type. Serializers registered will match all subclasses of the provided type, as well as unwrapped primitive equivalents of the type.- Type Parameters:
T
- The type to generify around- Parameters:
type
- The type to acceptserializer
- The serializer that will be serialized with- Returns:
- this
-
registerPredicate
@Deprecated public <T> TypeSerializerCollection registerPredicate(Predicate<TypeToken<T>> test, TypeSerializer<? super T> serializer)
Deprecated.Useregister(Predicate, TypeSerializer)
insteadRegister a type serializer matching against a given predicate.- Type Parameters:
T
- The type parameter- Parameters:
test
- The predicate to match types againstserializer
- The serializer to serialize matching types with- Returns:
- this
-
register
public <T> TypeSerializerCollection register(Predicate<TypeToken<T>> test, TypeSerializer<? super T> serializer)
Register a type serializer matching against a given predicate.- Type Parameters:
T
- The type parameter- Parameters:
test
- The predicate to match types againstserializer
- The serializer to serialize matching types with- Returns:
- this
-
register
public <T> TypeSerializerCollection register(ScalarSerializer<T> serializer)
Register a scalar serializer under its appropriate type. Serializers registered will match all subclasses- Type Parameters:
T
- The type to generify around- Parameters:
serializer
- The serializer that will be serialized with- Returns:
- this
-
newChild
public TypeSerializerCollection newChild()
-
-