X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.enterprise%2Fsrc%2Forg%2Fargeo%2Fnaming%2FDistinguished.java;h=8b9c4b92b2014c57bc3ae4a44e88f6d3b00ec1e4;hb=43e8bb2c3186c925991091e2b0f7002a940093c3;hp=ba0db49552c7001a0ec058ff039d9cbfc2daef3e;hpb=4ab4512d64d933847a82002cc6307243cdccb4fd;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.enterprise/src/org/argeo/naming/Distinguished.java b/org.argeo.enterprise/src/org/argeo/naming/Distinguished.java index ba0db4955..8b9c4b92b 100644 --- a/org.argeo.enterprise/src/org/argeo/naming/Distinguished.java +++ b/org.argeo.enterprise/src/org/argeo/naming/Distinguished.java @@ -1,5 +1,9 @@ package org.argeo.naming; +import java.util.EnumSet; +import java.util.Set; +import java.util.TreeSet; + import javax.naming.InvalidNameException; import javax.naming.ldap.LdapName; @@ -20,4 +24,13 @@ public interface Distinguished { throw new IllegalArgumentException("Distinguished name " + dn() + " is not properly formatted.", e); } } + + /** List all DNs of an enumeration as strings. */ + static Set enumToDns(EnumSet enumSet) { + Set res = new TreeSet<>(); + for (Enum enm : enumSet) { + res.add(((Distinguished) enm).dn()); + } + return res; + } }