Package yapion.serializing.api
Class SerializerObject<T>
- java.lang.Object
-
- yapion.serializing.api.SerializerBase<T,YAPIONObject>
-
- yapion.serializing.api.SerializerObject<T>
-
public abstract class SerializerObject<T> extends SerializerBase<T,YAPIONObject>
-
-
Constructor Summary
Constructors Constructor Description SerializerObject()
-
Method Summary
Modifier and Type Method Description void
add()
Add this ListSerializer to the SerializeManager by callingSerializeManager.add(SerializerBase)
.InternalSerializer<T>
convert()
abstract T
deserialize(DeserializeData<YAPIONObject> deserializeData)
This method is used to deserialize the type defined bytype()
.boolean
isInterface()
Returnstrue
iftype()
should be treated as an interface.abstract YAPIONObject
serialize(SerializeData<T> serializeData)
This method is used to serialize the type defined bytype()
.abstract java.lang.Class<T>
type()
Describes the Class type this Serializer should be used for by theYAPIONSerializer
andYAPIONDeserializer
this Serializer will be used preferably as it should suite the Class better than the internal fallback.
-
-
-
Method Detail
-
type
public abstract java.lang.Class<T> type()
Describes the Class type this Serializer should be used for by theYAPIONSerializer
andYAPIONDeserializer
this Serializer will be used preferably as it should suite the Class better than the internal fallback.- Specified by:
type
in classSerializerBase<T,YAPIONObject>
- Returns:
- the Class Type this Serializer is for
-
isInterface
public boolean isInterface()
Returnstrue
iftype()
should be treated as an interface.YAPIONSerializer
andYAPIONDeserializer
will treat this return type as secondary choice if a more specific serializer is missing.- Returns:
true
iftype()
should be treated as an interface,false
otherwise
-
serialize
public abstract YAPIONObject serialize(SerializeData<T> serializeData)
This method is used to serialize the type defined bytype()
. You will get the object to serialize as well as the currentYAPIONSerializer
designated to this serialization. This serializer should be used to serialize any parts of theObject
that are not primitive types. So anything that cannot be represented byYAPIONValue
. To use the serializer callYAPIONSerializer.parse(Object)
. You will need to provide the Object and the YAPIONSerializer will provide you with anYAPIONAnyType
. This is generic and can be anYAPIONObject
,YAPIONMap
,YAPIONArray
,YAPIONPointer
orYAPIONValue
. So you should be able to handle any thing you can get or just handle it generically withYAPIONAnyType
to be safe.- Specified by:
serialize
in classSerializerBase<T,YAPIONObject>
- Parameters:
serializeData
- all data for serialization- Returns:
- the serialized version of the inputted Object
-
deserialize
public abstract T deserialize(DeserializeData<YAPIONObject> deserializeData)
This method is used to deserialize the type defined bytype()
. You will get the specifiedYAPIONObject
as well as the currentYAPIONDeserializer
designed to this deserialization. This deserializer should be used to deserialize any parts of theYAPIONObject
that are notYAPIONValue
types. So anything that cannot be represented byYAPIONValue
. To use the serializer callYAPIONDeserializer.parse(YAPIONAnyType)
. You will need to provide theYAPIONAnyType
and the YAPIONDeserializer will provide you with anObject
. This is generic and can be any Object. So you should be able to handle any thing generically.- Specified by:
deserialize
in classSerializerBase<T,YAPIONObject>
- Parameters:
deserializeData
- all data for deserialization- Returns:
- the deserialized version of the inputted
YAPIONObject
-
convert
public InternalSerializer<T> convert()
- Overrides:
convert
in classSerializerBase<T,YAPIONObject>
-
add
public final void add()
Add this ListSerializer to the SerializeManager by callingSerializeManager.add(SerializerBase)
.
-
-