Search in sources :

Example 1 with ConfigCollection

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() + ".");
}
Also used : GoCipher(com.thoughtworks.go.security.GoCipher) Element(org.jdom2.Element) ConfigCollection(com.thoughtworks.go.config.ConfigCollection) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

ConfigCollection (com.thoughtworks.go.config.ConfigCollection)1 GoCipher (com.thoughtworks.go.security.GoCipher)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Element (org.jdom2.Element)1