AttrStringArray extends Attr<String[]> { public static Builder builder() { return new Builder(); } private  AttrStringArray(
      String[] value, List<? extends Constraint<? super String[]>> constraint, String label); void set(String value, String... values); static Builder builder();  }
@Test public void testListValue() { class Clazz extends AttrComposite { public AttrStringArray value = attributes.register("value", AttrStringArray.builder().defaultValue(new String[0])); } AliasMapper mapper = new AliasMapper(); mapper.alias("clazz", Clazz.class, Clazz::new); Assertions.assertThat( Attrs.populate( new Clazz(), Map.of("value", new String[] {"foo", "bar", null}), mapper::fromName) .value .get()) .isEqualTo(new String[] {"foo", "bar", null}); Assertions.assertThat( Attrs.populate( new Clazz(), Map.of("value", Arrays.asList("foo", "bar", null)), mapper::fromName) .value .get()) .isEqualTo(new String[] {"foo", "bar", null}); Assertions.assertThat( Attrs.populate( new Clazz(), Map.of("value", new Object[] {"foo", "bar", null}), mapper::fromName) .value .get()) .isEqualTo(new String[] {"foo", "bar", null}); Assertions.assertThat( Attrs.populate( new Clazz(), Map.of("value", new CharSequence[] {"foo", "bar", null}), mapper::fromName) .value .get()) .isEqualTo(new String[] {"foo", "bar", null}); Assertions.assertThatCode( () -> { Attrs.populate( new Clazz(), Map.of("value", List.of(new Object(), "bar")), mapper::fromName) .value .get(); }) .isInstanceOf(IllegalArgumentException.class); Assertions.assertThatCode( () -> { Attrs.populate( new Clazz(), Map.of("value", new Object[] {"bar", new Object(), null}), mapper::fromName) .value .get(); }) .isInstanceOf(IllegalArgumentException.class); }