package eu.dnetlib.ariadneplus.elasticsearch.model; import com.google.gson.Gson; import com.google.gson.JsonElement; import java.util.Map; public class ArchaeologicalResourceType { private long id = 100000; private String name; public ArchaeologicalResourceType() { } // public static ArchaeologicalResourceType fromRDFJson(JsonElement json) { // ArchaeologicalResourceType art = new ArchaeologicalResourceType(); // for (Map.Entry entry : json.getAsJsonObject().entrySet()){ // switch (entry.getKey()){ // case "https://www.ariadne-infrastructure.eu/property/id" : // art.setId(entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString()); // break; // case "https://www.ariadne-infrastructure.eu/property/name": // String tmp = entry.getValue().getAsJsonArray().get(0).getAsJsonObject().get("value").getAsString(); // art.setName(tmp); // break; // // } // } // // return art; // } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public static ArchaeologicalResourceType fromJson(String json){ return new Gson().fromJson(json, ArchaeologicalResourceType.class); } }