MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / validateCollection

Method validateCollection

src/query/pojo/Validatable.java:32–45  ·  view source on GitHub ↗

Iterate through a field that is a collection of POJOs and validate each of them. Inherit member POJO's error message. @param collection the validatable POJO collection @param name name of the field

(final Collection<T> collection,
                                                  final String name)

Source from the content-addressed store, hash-verified

30 * @param name name of the field
31 */
32 <T extends Validatable> void validateCollection(final Collection<T> collection,
33 final String name) {
34 Iterator<T> iterator = collection.iterator();
35 int i = 0;
36 while (iterator.hasNext()) {
37 try {
38 iterator.next().validate();
39 } catch (final IllegalArgumentException e) {
40 throw new IllegalArgumentException("Invalid " + name +
41 " at index " + i, e);
42 }
43 i++;
44 }
45 }
46
47 /**
48 * Validate a single POJO validate

Callers 1

validateMethod · 0.80

Calls 4

iteratorMethod · 0.65
hasNextMethod · 0.65
validateMethod · 0.65
nextMethod · 0.65

Tested by

no test coverage detected