/** * @param clazz type of elements in the {@code value} list; must be one of {@code Boolean.class}, * {@code Integer.class}, {@code Long.class}, {@code String.class} or {@code ModelNode.class} * @throws IllegalArgumentException if {@code clazz} is not one of the known types */ public <T> Values andListOptional(Class<T> clazz, String name, List<T> value) { if (value == null) return this; return andList(clazz, name, value); }
public static Values ofList(String name, boolean... value) { return EMPTY.andList(name, value); }
public static Values ofList(String name, double... value) { return EMPTY.andList(name, value); }
public static Values ofList(String name, String... value) { return EMPTY.andList(name, value); }
public static Values ofList(String name, int... value) { return EMPTY.andList(name, value); }
public static Values ofList(String name, long... value) { return EMPTY.andList(name, value); }
public static Values ofList(String name, ModelNode... value) { return EMPTY.andList(name, value); }
/** * @param clazz type of elements in the {@code value} list; must be one of {@code Boolean.class}, * {@code Integer.class}, {@code Long.class}, {@code Double.class}, {@code String.class} * or {@code ModelNode.class} * @throws IllegalArgumentException if {@code clazz} is not one of the known types * @throws ClassCastException if some elements of the {@code value} list are not of type {@code clazz} * @throws ArrayStoreException if some elements of the {@code value} list are not of type {@code clazz} */ @SuppressWarnings({"unchecked", "SuspiciousToArrayCall"}) public <T> Values andList(Class<T> clazz, String name, List<T> value) { if (clazz == Boolean.class) { return andList(name, Booleans.toArray((List<Boolean>) value)); } else if (clazz == Integer.class) { return andList(name, Ints.toArray((List<Integer>) value)); } else if (clazz == Long.class) { return andList(name, Longs.toArray((List<Long>) value)); } else if (clazz == Double.class) { return andList(name, Doubles.toArray((List<Double>) value)); } else if (clazz == String.class) { return andList(name, value.toArray(new String[value.size()])); } else if (clazz == ModelNode.class) { return andList(name, value.toArray(new ModelNode[value.size()])); } else { throw new IllegalArgumentException("Only List<Boolean>, List<Integer>, List<Long>, List<Double>, " + "List<String> and List<ModelNode> are supported"); } }