blob: 04dd45e930bdbf36950837d734db2bad9fdbc9f1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package org.openslx.dnbd3.status.output;
import java.lang.reflect.Type;
import org.openslx.graph.Edge;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
public class EdgeSerializer implements JsonSerializer<Edge>
{
@Override
public JsonElement serialize( Edge src, Type typeOfSrc, JsonSerializationContext context )
{
final JsonObject out = new JsonObject();
out.addProperty( "source", src.getSource().getId() );
out.addProperty( "target", src.getTarget().getId() );
out.addProperty( "received", src.getWeight() );
return out;
}
}
|