@Test public void testCompositeJavaDataShape() throws Exception { final ObjectNode ds = new ObjectMapper().createObjectNode(); ds.put("type", "java:" + String.class.getName()); final Optional<DataShape> shape = DataShapeUtils.buildDataShape(ds); assertThat(shape.isPresent()).isTrue(); assertThat(shape.get().getKind()).isEqualTo(DataShapeKinds.JAVA); assertThat(shape.get().getType()).isEqualTo(String.class.getName()); assertThat(shape.get().getName()).isNull(); assertThat(shape.get().getDescription()).isNull(); assertThat(shape.get().getSpecification()).isNull(); }
static Optional<DataShape> buildDataShape(final JsonNode root) { if (root == null) { return Optional.empty(); } final DataShape.Builder builder = new DataShape.Builder(); addKindAndTypeTo(builder, root); addValueTo(root, "name", builder::name); addValueTo(root, "description", builder::description); addValueTo(root, "specification", builder::specification); addMetadataTo(builder, root); addVariantsTo(builder, root); return Optional.of(builder.build()); }
DataShapeUtils { static Optional<DataShape> buildDataShape(final JsonNode root) { if (root == null) { return Optional.empty(); } final DataShape.Builder builder = new DataShape.Builder(); addKindAndTypeTo(builder, root); addValueTo(root, "name", builder::name); addValueTo(root, "description", builder::description); addValueTo(root, "specification", builder::specification); addMetadataTo(builder, root); addVariantsTo(builder, root); return Optional.of(builder.build()); } }
DataShapeUtils { static Optional<DataShape> buildDataShape(final JsonNode root) { if (root == null) { return Optional.empty(); } final DataShape.Builder builder = new DataShape.Builder(); addKindAndTypeTo(builder, root); addValueTo(root, "name", builder::name); addValueTo(root, "description", builder::description); addValueTo(root, "specification", builder::specification); addMetadataTo(builder, root); addVariantsTo(builder, root); return Optional.of(builder.build()); } private  DataShapeUtils(); }
DataShapeUtils { static Optional<DataShape> buildDataShape(final JsonNode root) { if (root == null) { return Optional.empty(); } final DataShape.Builder builder = new DataShape.Builder(); addKindAndTypeTo(builder, root); addValueTo(root, "name", builder::name); addValueTo(root, "description", builder::description); addValueTo(root, "specification", builder::specification); addMetadataTo(builder, root); addVariantsTo(builder, root); return Optional.of(builder.build()); } private  DataShapeUtils();  }
DataShapeUtils { static Optional<DataShape> buildDataShape(final JsonNode root) { if (root == null) { return Optional.empty(); } final DataShape.Builder builder = new DataShape.Builder(); addKindAndTypeTo(builder, root); addValueTo(root, "name", builder::name); addValueTo(root, "description", builder::description); addValueTo(root, "specification", builder::specification); addMetadataTo(builder, root); addVariantsTo(builder, root); return Optional.of(builder.build()); } private  DataShapeUtils();   }