ListType extends AbstractType { public boolean isAssignableValue(Object source) { if (source == null) { return true; } if (source instanceof TypedList) { return this.equals(((TypedList) source).getType()); } if (source instanceof Collection) { for (Object sourceElement : (Iterable<?>) source) { if (elementType.isAssignableValue(sourceElement) == false) { return false; } } return true; } if (source.getClass().isArray()) { return elementType.isAssignableFrom(source.getClass().getComponentType()); } return false; } ListType();  ListType(final String id, final String name, final Type elementType); Type getElementType(); void setElementType(Type elementType); @Override boolean isAssignableFrom(Class<?> clazz); Object convertToTypedObject(final Object source); boolean isAssignableValue(Object source); @Override boolean isValid();  }
@Test public void testIsAssigableValue() throws Exception { ListType stringListType = new ListType("string[]", "string[]", PrimitiveType.STRING); List<String> stringList = new ArrayList<String>() { private static final long serialVersionUID = 9045815271522604267L; { add("a"); add("b"); add("c"); }}; assertTrue(stringListType.isAssignableValue(stringList)); assertTrue(stringListType.isAssignableValue(new String[] { "a", "b", "c" })); ListType integerListType = new ListType("integer[]", "integer[]", PrimitiveType.INTEGER); assertTrue(integerListType.isAssignableValue(new int[] { 1, 2, 3 })); assertTrue(integerListType.isAssignableValue(new byte[] { 1, 2, 3 })); assertFalse(integerListType.isAssignableValue(new long[] { 1L, 2L, 3L })); }