Added convenience method to check Role existance by string
This commit is contained in:
parent
c75eb8af91
commit
2e0fb63ee6
|
@ -1,5 +1,8 @@
|
|||
package org.gcube.oidc;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class D4ScienceMappings {
|
||||
|
||||
public enum Role {
|
||||
|
@ -16,6 +19,8 @@ public class D4ScienceMappings {
|
|||
VRE_DESIGNER("VRE-Designer"),
|
||||
VRE_MANAGER("VRE-Manager");
|
||||
|
||||
private static Set<String> STRING_VALUES;
|
||||
|
||||
private String str;
|
||||
|
||||
Role(String str) {
|
||||
|
@ -25,6 +30,22 @@ public class D4ScienceMappings {
|
|||
public String asString() {
|
||||
return str;
|
||||
}
|
||||
|
||||
static {
|
||||
STRING_VALUES = new HashSet<String>();
|
||||
for (Role role : Role.values()) {
|
||||
STRING_VALUES.add(role.asString());
|
||||
}
|
||||
}
|
||||
|
||||
public static Set<String> stringValues() {
|
||||
return STRING_VALUES;
|
||||
}
|
||||
|
||||
public static boolean exists(String role) {
|
||||
return STRING_VALUES.contains(role);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum Scope {
|
||||
|
|
Loading…
Reference in New Issue