Tuple { public Object get(String name) { if (name == null) throw new IllegalArgumentException("name must not be null"); return schema.get(name, values); } Tuple(TupleSchema schema, Object[] values); Object get(String name); T get(TupleKey<T> key); Map<String, V> serialise(Function<Object, V> serialiser); Map<String, Object> toMap(); TupleSchema getSchema(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void resolvesNamesToValues() { Tuple person = personSchema.makeWith( "Dominic", 41, addressSchema.makeWith(asList("23 Acacia Avenue", "Sunderland"), "VB6 5UX")); assertThat(person.get("name"), equalTo("Dominic")); assertThat(person.get("age"), equalTo(41)); assertThat(((Tuple) person.get("address")).get("postcode"), equalTo("VB6 5UX")); }
@Test public void makeWithWithNamedValues() { Tuple person = personSchema.make( NamedValue.of("name", "Dominic"), NamedValue.of("age", 41), NamedValue.of("address", addressSchema.make( NamedValue.of("addressLines", asList("23 Acacia Avenue", "Sunderland")), NamedValue.of("postcode", "VB6 5UX")))); assertThat(person.get("name"), equalTo("Dominic")); assertThat(person.get("age"), equalTo(41)); assertThat(((Tuple) person.get("address")).get("postcode"), equalTo("VB6 5UX")); }