日期:2014-05-20 浏览次数:20709 次
public class Node {
private String nodeid;
private String port1;
private String port2;
private String port3;
private String port4;
public Node(String Value)
{
super();
}
public String getNodeid() {
return nodeid;
}
public void setNodeid(String nodeid) {
this.nodeid = nodeid;
}
public String getPort1() {
return port1;
}
public void setPort1(String port1) {
this.port1 = port1;
}
public String getPort2() {
return port2;
}
public void setPort2(String port2) {
this.port2 = port2;
}
public String getPort3() {
return port3;
}
public void setPort3(String port3) {
this.port3 = port3;
}
public String getPort4() {
return port4;
}
public void setPort4(String port4) {
this.port4 = port4;
}
}
public static void main(String[] args) throws Exception {
String str="[{\"nodeid\":\"9\",\"port1\":\"2\",\"port2\":\"3\",\"port3\":\"1\",\"port4\":\"4\"},{\"nodeid\":\"1\",\"port1\":\"2\",\"port2\":\"2\",\"port3\":\"4\",\"port4\":\"8\"}]";
ObjectMapper mapper=new ObjectMapper();
Node n=mapper.readValue(str, Node.class);
//System.out.println(response);
System.out.println(n);
}