int count = child.getValue(); String tag = child.getKey(); Cardinality cardinality = getDefinition().getCardinality(tag); map.remove(tag);
public void validateChild(ComponentDefinition childDefinition, IntSupplier childCount) { if (!childrenAllowed()) { throw new ComponentException(componentClass, "Children are not allowed"); } childDefinition.validateParent(this); Cardinality cardinality = getCardinality(childDefinition.tag); if (cardinality == null) { throw new ComponentException(componentClass, "%s is not a valid child", childDefinition.componentClass); } if (cardinality.hasMaximum() && childCount.getAsInt() >= cardinality.getMaximum()) { throw new ComponentException(componentClass, "A maximum of %d children of type %s are allowed", cardinality.getMaximum(), childDefinition.componentClass); } }