@Test public void testApplicationIdEncode() { int id = 1; String name = "org.onosproject.foo"; ApplicationId appId = new DefaultApplicationId(id, name); ObjectNode applicationIdJson = applicationIdCodec.encode(appId, context); assertThat(applicationIdJson, ApplicationIdJsonMatcher.matchesApplicationId(appId)); }
@Override public ObjectNode encode(ApplicationId appId, CodecContext context) { checkNotNull(appId, "ApplicationId cannot be null"); ObjectNode result = context.mapper().createObjectNode() .put("id", appId.id()) .put("name", appId.name()); return result; }
ApplicationIdCodec extends JsonCodec<ApplicationId> { @Override public ObjectNode encode(ApplicationId appId, CodecContext context) { checkNotNull(appId, "ApplicationId cannot be null"); ObjectNode result = context.mapper().createObjectNode() .put("id", appId.id()) .put("name", appId.name()); return result; } }
ApplicationIdCodec extends JsonCodec<ApplicationId> { @Override public ObjectNode encode(ApplicationId appId, CodecContext context) { checkNotNull(appId, "ApplicationId cannot be null"); ObjectNode result = context.mapper().createObjectNode() .put("id", appId.id()) .put("name", appId.name()); return result; }  }
ApplicationIdCodec extends JsonCodec<ApplicationId> { @Override public ObjectNode encode(ApplicationId appId, CodecContext context) { checkNotNull(appId, "ApplicationId cannot be null"); ObjectNode result = context.mapper().createObjectNode() .put("id", appId.id()) .put("name", appId.name()); return result; }  @Override ObjectNode encode(ApplicationId appId, CodecContext context); @Override ApplicationId decode(ObjectNode json, CodecContext context); }
ApplicationIdCodec extends JsonCodec<ApplicationId> { @Override public ObjectNode encode(ApplicationId appId, CodecContext context) { checkNotNull(appId, "ApplicationId cannot be null"); ObjectNode result = context.mapper().createObjectNode() .put("id", appId.id()) .put("name", appId.name()); return result; }  @Override ObjectNode encode(ApplicationId appId, CodecContext context); @Override ApplicationId decode(ObjectNode json, CodecContext context);  }