Revision 46128
Added by Claudio Atzori about 7 years ago
Pid.java | ||
---|---|---|
5 | 5 |
import com.google.common.base.Function; |
6 | 6 |
import com.google.common.collect.Iterables; |
7 | 7 |
import com.google.common.collect.Lists; |
8 |
import com.google.common.reflect.TypeToken; |
|
9 | 8 |
import com.google.gson.Gson; |
10 | 9 |
import com.google.gson.GsonBuilder; |
11 | 10 |
import org.apache.commons.logging.Log; |
... | ... | |
26 | 25 |
|
27 | 26 |
log.debug(String.format("\nPid: %s", json)); |
28 | 27 |
|
29 |
final GsonBuilder gb = new GsonBuilder(); |
|
30 |
gb.registerTypeAdapter(Pid.class, new PidOafSerialiser()); |
|
31 |
final Gson gson = gb.create(); |
|
32 |
|
|
33 | 28 |
return Lists.newArrayList(Iterables.transform(json, new Function<String, Pid>() { |
34 | 29 |
@Override |
35 | 30 |
public Pid apply(final String s) { |
36 |
return gson.fromJson(s, Pid.class);
|
|
31 |
return fromOafJson(s);
|
|
37 | 32 |
} |
38 | 33 |
})); |
39 | 34 |
} |
40 | 35 |
|
36 |
public static Pid fromOafJson(final String json) { |
|
37 |
//System.out.println(String.format("\nPid: %s", json)); |
|
38 |
|
|
39 |
final GsonBuilder gb = new GsonBuilder(); |
|
40 |
gb.registerTypeAdapter(Pid.class, new PidOafSerialiser()); |
|
41 |
final Gson gson = gb.create(); |
|
42 |
return gson.fromJson(json, Pid.class); |
|
43 |
} |
|
44 |
|
|
41 | 45 |
public String getType() { |
42 | 46 |
return type; |
43 | 47 |
} |
Also available in: Unified diff
backported PidClustering from dnet50