@Test public void serialization() { Interface iface = new Interface("node", "name", InterfaceType.PHYSICAL); Map<String, String> properties = new HashMap<>(); properties.put("key", "value"); iface.setProperties(properties); JsonNode jsonNode = BatfishObjectMapper.mapper().valueToTree(iface); assertThat(jsonNode.get("id").asText(), equalTo(Interface.getId("node", "name"))); assertThat(jsonNode.get("nodeId").asText(), equalTo("node")); assertThat(jsonNode.get("name").asText(), equalTo("name")); assertThat(jsonNode.get("type").asText(), equalTo("PHYSICAL")); assertThat(jsonNode.get("properties").get("key").asText(), equalTo("value")); }
public static String getId(String nodeId, String name) { return "interface-" + nodeId + "-" + name; }
Interface extends BfObject { public static String getId(String nodeId, String name) { return "interface-" + nodeId + "-" + name; } }
Interface extends BfObject { public static String getId(String nodeId, String name) { return "interface-" + nodeId + "-" + name; } Interface(String nodeId, String name);  Interface(String nodeId, String name, InterfaceType type); @JsonCreator  Interface(
      @JsonProperty(PROP_ID) String id,
      @Nonnull @JsonProperty(PROP_NODE_ID) String nodeId,
      @Nonnull @JsonProperty(PROP_NAME) String name,
      @JsonProperty(PROP_TYPE) InterfaceType type); }
Interface extends BfObject { public static String getId(String nodeId, String name) { return "interface-" + nodeId + "-" + name; } Interface(String nodeId, String name);  Interface(String nodeId, String name, InterfaceType type); @JsonCreator  Interface(
      @JsonProperty(PROP_ID) String id,
      @Nonnull @JsonProperty(PROP_NODE_ID) String nodeId,
      @Nonnull @JsonProperty(PROP_NAME) String name,
      @JsonProperty(PROP_TYPE) InterfaceType type); static String getId(String nodeId, String name); @JsonProperty(PROP_NAME) String getName(); @JsonProperty(PROP_NODE_ID) String getNodeId(); @JsonProperty(PROP_TYPE) InterfaceType getType(); @JsonProperty(PROP_TYPE) void setType(InterfaceType type); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
Interface extends BfObject { public static String getId(String nodeId, String name) { return "interface-" + nodeId + "-" + name; } Interface(String nodeId, String name);  Interface(String nodeId, String name, InterfaceType type); @JsonCreator  Interface(
      @JsonProperty(PROP_ID) String id,
      @Nonnull @JsonProperty(PROP_NODE_ID) String nodeId,
      @Nonnull @JsonProperty(PROP_NAME) String name,
      @JsonProperty(PROP_TYPE) InterfaceType type); static String getId(String nodeId, String name); @JsonProperty(PROP_NAME) String getName(); @JsonProperty(PROP_NODE_ID) String getNodeId(); @JsonProperty(PROP_TYPE) InterfaceType getType(); @JsonProperty(PROP_TYPE) void setType(InterfaceType type); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }