Skip to the content.

Context [WIP not up to date]

Some YAPION annotation have a context array, that you can specify if desired. This is useful to create specific views onto a given object. You can use this for some api system as an example or just to load fewer data than you save. You can provide a context to either the YAPIONSerializer or YAPIONDeserializer as a String.

import yapion.annotations.deserialize.YAPIONLoad;
import yapion.annotations.serialize.YAPIONSave;
import yapion.serializing.YAPIONSerializer;

@YAPIONSave
@YAPIONLoad
public class ExampleContext {

    @YAPIONSave
    private long time = System.currentTimeMillis();

    @YAPIONSave
    @YAPIONLoad
    private int number = 0;

    @YAPIONSave(context = "test")
    private int numberTwo = 0;

    @YAPIONSave(context = {"test", "test2"})
    private int numberThree = 0;

    public static void main(String[] args) {
        YAPIONSerializer.serialize(new ExampleContext());
        YAPIONSerializer.serialize(new ExampleContext(), "test");
        YAPIONSerializer.serialize(new ExampleContext(), "test2");
    }

}

Context Management rules: