Example usage for com.badlogic.gdx.utils Json readFields

List of usage examples for com.badlogic.gdx.utils Json readFields

Introduction

In this page you can find the example usage for com.badlogic.gdx.utils Json readFields.

Prototype

public void readFields(Object object, JsonValue jsonMap) 

Source Link

Usage

From source file:com.strategames.engine.utils.Level.java

License:Open Source License

@Override
public void read(Json json, JsonValue jsonData) {
    json.readFields(this, jsonData);
}

From source file:es.eucm.ead.engine.assets.serializers.DefaultSerializer.java

License:Open Source License

@Override
@SuppressWarnings("all")
public T read(Json json, JsonValue jsonData, Class type) {
    T o = null;//from ww  w. j  av  a  2s .  com
    try {
        o = (T) ClassReflection.newInstance(type);
    } catch (ReflectionException e) {
        Gdx.app.error("DefaultSerializer", "Error creating instance for " + type, e);
    }
    json.readFields(o, jsonData);
    return o;
}

From source file:es.eucm.ead.engine.assets.serializers.SceneElementSerializer.java

License:Open Source License

@Override
public SceneElement read(Json json, JsonValue jsonData, Class type) {
    SceneElement sceneElement;/*  w  w  w .j  av a 2 s .c  o m*/
    // Create the basis scene element
    JsonValue ref = jsonData.get("ref");
    if (ref != null) {
        // Based on another scene element
        sceneElement = assets.fromJsonPath(SceneElement.class, ref.asString());
    } else {
        // Based on an empty scene element
        sceneElement = new SceneElement();
    }

    json.readFields(sceneElement, jsonData);
    return sceneElement;
}