use of com.thoughtworks.go.config.ConfigCollection in project gocd by gocd.
the class GoConfigClassLoader method parseCollection.
@SuppressWarnings("unchecked")
private void parseCollection(Collection collection) {
ConfigCollection collectionAnnotation = annotationFor(aClass, ConfigCollection.class);
Class<?> elementType = collectionAnnotation.value();
for (Element childElement : (List<Element>) e.getChildren()) {
if (isInCollection(childElement, elementType)) {
Class<?> collectionType = findConcreteType(childElement, elementType);
collection.add(classParser(childElement, collectionType, configCache, new GoCipher(), registry, configReferenceElements).parse());
}
}
int minimumSize = collectionAnnotation.minimum();
bombIf(collection.size() < minimumSize, "Required at least " + minimumSize + " subelements to '" + e.getName() + "'. " + "Found " + collection.size() + ".");
}
Aggregations