Package yapion.serializing
Class YAPIONSerializer
- java.lang.Object
-
- yapion.serializing.YAPIONSerializer
-
public final class YAPIONSerializer extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description YAPIONSerializer(@NonNull java.lang.Object object, java.lang.String context)
Creates a YAPIONSerializer for serializing an Object with a specified context.YAPIONSerializer(@NonNull java.lang.Object object, java.lang.String context, boolean strict)
Creates a YAPIONSerializer for serializing an Object with a specified context.
-
Method Summary
Modifier and Type Method Description YAPIONObject
getYAPIONObject()
Get the internal parsed YAPIONObject.boolean
isStrict()
Returns whether the serialization should be strict and should not allow any data loss while serializing.YAPIONSerializer
parse()
Parses the Object to the YAPIONObject.YAPIONAnyType
parse(java.lang.Object object)
static YAPIONObject
serialize(@NonNull java.lang.Object object)
Serialize an Object to an YAPION Object.static YAPIONObject
serialize(@NonNull java.lang.Object object, boolean strict)
Serialize an Object to an YAPION Object.static YAPIONObject
serialize(@NonNull java.lang.Object object, java.lang.String context)
Serialize an Object to an YAPION Object.static YAPIONObject
serialize(@NonNull java.lang.Object object, java.lang.String context, boolean strict)
Serialize an Object to an YAPION Object.
-
-
-
Constructor Detail
-
YAPIONSerializer
public YAPIONSerializer(@NonNull @NonNull java.lang.Object object, java.lang.String context)
Creates a YAPIONSerializer for serializing an Object with a specified context.- Parameters:
object
- to serializecontext
- the context for serialization
-
YAPIONSerializer
public YAPIONSerializer(@NonNull @NonNull java.lang.Object object, java.lang.String context, boolean strict)
Creates a YAPIONSerializer for serializing an Object with a specified context.- Parameters:
object
- to serializecontext
- the context for serializationstrict
- if serialization should be strict and check if any data would get lost while serialization
-
-
Method Detail
-
serialize
public static YAPIONObject serialize(@NonNull @NonNull java.lang.Object object)
Serialize an Object to an YAPION Object.- Parameters:
object
- to serialize- Returns:
- YAPIONObject from the object to serialize
-
serialize
public static YAPIONObject serialize(@NonNull @NonNull java.lang.Object object, boolean strict)
Serialize an Object to an YAPION Object.- Parameters:
object
- to serializestrict
- if serialization should be strict and check if any data would get lost while serialization- Returns:
- YAPIONObject from the object to serialize
-
serialize
public static YAPIONObject serialize(@NonNull @NonNull java.lang.Object object, java.lang.String context)
Serialize an Object to an YAPION Object.- Parameters:
object
- to serializecontext
- the context for serialization- Returns:
- YAPIONObject from the object to serialize
-
serialize
public static YAPIONObject serialize(@NonNull @NonNull java.lang.Object object, java.lang.String context, boolean strict)
Serialize an Object to an YAPION Object.- Parameters:
object
- to serializecontext
- the context for serializationstrict
- if serialization should be strict and check if any data would get lost while serialization- Returns:
- YAPIONObject from the object to serialize
-
parse
public YAPIONAnyType parse(java.lang.Object object)
- Parameters:
object
- to parse- Returns:
- the
YAPIONAnyType
of the Object inputted
-
isStrict
public boolean isStrict()
Returns whether the serialization should be strict and should not allow any data loss while serializing.- Returns:
true
if data loss should be prohibited,false
otherwise
-
parse
public YAPIONSerializer parse()
Parses the Object to the YAPIONObject.
-
getYAPIONObject
public YAPIONObject getYAPIONObject()
Get the internal parsed YAPIONObject.- Returns:
- YAPIONObject from the object to serialize
-
-