@Test public void convertsToNodeAndBuilder() { ShapeId id = ShapeId.from("ns.qux#foo"); ArrayNode values = Node.arrayNode() .withValue(Node.objectNode() .withMember("resource", Node.from("ns.foo#SomeShape")) .withMember("ids", Node.parse("{\"a\": \"a\", \"b\": \"b\"}"))) .withValue(Node.objectNode() .withMember("resource", Node.from("ns.foo#OtherShape")) .withMember("ids", Node.parse("{\"c\": \"c\"}")) .withMember("rel", Node.from("rel"))) .withValue(Node.objectNode() .withMember("resource", Node.from("ns.foo#OtherShape")) .withMember("ids", Node.parse("{\"c\": \"c\"}")) .withMember("service", Node.from("foo.baz#Bar"))); ReferencesTrait trait = new ReferencesTrait.Provider().createTrait(id, values); assertThat(trait.toNode(), equalTo(values)); assertThat(trait.toBuilder().build(), equalTo(trait)); }
@Override public Builder toBuilder() { Builder builder = new Builder().sourceLocation(getSourceLocation()); references.forEach(builder::addReference); return builder; }
ReferencesTrait extends AbstractTrait implements ToSmithyBuilder<ReferencesTrait> { @Override public Builder toBuilder() { Builder builder = new Builder().sourceLocation(getSourceLocation()); references.forEach(builder::addReference); return builder; } }
ReferencesTrait extends AbstractTrait implements ToSmithyBuilder<ReferencesTrait> { @Override public Builder toBuilder() { Builder builder = new Builder().sourceLocation(getSourceLocation()); references.forEach(builder::addReference); return builder; } private  ReferencesTrait(Builder builder); }
ReferencesTrait extends AbstractTrait implements ToSmithyBuilder<ReferencesTrait> { @Override public Builder toBuilder() { Builder builder = new Builder().sourceLocation(getSourceLocation()); references.forEach(builder::addReference); return builder; } private  ReferencesTrait(Builder builder); List<Reference> getReferences(); List<Reference> getResourceReferences(ShapeId shapeId); @Override Builder toBuilder(); static Builder builder(); }
ReferencesTrait extends AbstractTrait implements ToSmithyBuilder<ReferencesTrait> { @Override public Builder toBuilder() { Builder builder = new Builder().sourceLocation(getSourceLocation()); references.forEach(builder::addReference); return builder; } private  ReferencesTrait(Builder builder); List<Reference> getReferences(); List<Reference> getResourceReferences(ShapeId shapeId); @Override Builder toBuilder(); static Builder builder(); static final ShapeId ID; }