EffectSerializer

class EffectSerializer

Serialize Alchemist effect groups from/to file in human readable format (JSON).

This class can be considered a clean boundary between Google Gson library and the needs of this project, providing methods to serialize and deserialize from JSON files instances of EffectGroup.

The GSON object used for serialization is statically updated at runtime with all available TypeAdapters and RuntimeTypeAdapter.

See also

com.google.gson.Gson

Functions

Link copied to clipboard
open fun <P : Position2D<out P>?> effectFromFile(effectFile: File): EffectFX<P>
Get an Effect from the specified file.
Link copied to clipboard
open fun <P : Position2D<out P>?> effectFromResources(resource: String): EffectFX<P>
Get an Effect from the specified resource file.
Link copied to clipboard
open fun <P : Position2D<out P>?> effectGroupsFromFile(effectFile: File): List<EffectGroup<P>>
Get a list of EffectGroup from the specified file.
Link copied to clipboard
open fun <P : Position2D<out P>?> effectGroupsFromResources(resource: String): List<EffectGroup<P>>
Get a list of EffectGroup from the specified resource file.
Link copied to clipboard
open fun <P : Position2D<out P>?> effectGroupsToFile(effectFile: File, effects: List<EffectGroup<P>>)
Write the given list of EffectGroups to the destination file.
Link copied to clipboard
open fun <P : Position2D<out P>?> effectsFromFile(effectFile: File): EffectGroup<P>
Get an EffectGroup from the specified file.
Link copied to clipboard
open fun <P : Position2D<out P>?> effectsFromResources(resource: String): EffectGroup<P>
Get an EffectGroup from the specified resource file.
Link copied to clipboard
open fun <P : Position2D<out P>?> effectsToFile(effectFile: File, effects: EffectGroup<P>)
Write the given EffectGroup to the destination file.
Link copied to clipboard
open fun <P : Position2D<out P>?> effectToFile(effectFile: File, effect: EffectFX<P>)
Write the given EffectFX to the destination file.
Link copied to clipboard
@Contract(pure = true)
@TestOnly
open fun getGSON(): Gson
Returns the internal static instance of Gson object used for serialization.

Properties

Link copied to clipboard
val DEFAULT_CHARSET: Charset
Default charset of serialized groups of effects.
Link copied to clipboard
val DEFAULT_EXTENSION: String
Default extension of serialized groups of effects.