in src/main/java/org/apache/sling/feature/apiregions/model/ApiRegions.java [38:50]
public ApiRegion addNew(String regionName) {
if (regionName == null || regionName.isEmpty()) {
throw new IllegalArgumentException("Impossible to create a new API Region without specifying a valid name");
}
if (getByName(regionName) != null) {
throw new IllegalArgumentException("API Region '" + regionName + "' already exists, please specifying a different valid name");
}
ApiRegion parent = regions.isEmpty() ? null : regions.peek(); // null parent means 'root' in the hierarchy
ApiRegion newRegion = new ApiRegion(regionName, parent);
return regions.push(newRegion);
}