Example usage for com.vaadin.server JsonCodec encode

List of usage examples for com.vaadin.server JsonCodec encode

Introduction

In this page you can find the example usage for com.vaadin.server JsonCodec encode.

Prototype

public static EncodeResult encode(Object value, JsonValue diffState, Type valueType,
            ConnectorTracker connectorTracker) 

Source Link

Usage

From source file:annis.libgui.Helper.java

License:Apache License

public static <T> JsonValue encodeGeneric(Object v) {
    return JsonCodec.encode(v, null, v.getClass().getGenericSuperclass(), null).getEncodedValue();
}

From source file:de.elomagic.vaadin.addon.networkgraph.NetworkGraph.java

License:Apache License

private Object encodeObject(Object o) {
    try {// www  . j  a  v  a2  s .  c o  m
        EncodeResult result = JsonCodec.encode(o, null, o.getClass(), null);
        return result.getEncodedValue();
    } catch (JSONException e) {
        throw new RuntimeException(e);
    }
}