reverse lookup for clientdetails utiltiy classes

pull/210/head
Justin Richer 2012-08-27 14:45:14 -04:00
parent 21ff134383
commit 29ac1a3a70
1 changed files with 24 additions and 0 deletions

View File

@ -122,6 +122,14 @@ public class ClientDetailsEntity implements ClientDetails {
private final String value;
// map to aid reverse lookup
private static final Map<String, AuthType> lookup = new HashMap<String, AuthType>();
static {
for (AuthType a : AuthType.values()) {
lookup.put(a.getValue(), a);
}
}
AuthType(String value) {
this.value = value;
}
@ -129,6 +137,10 @@ public class ClientDetailsEntity implements ClientDetails {
public String getValue() {
return value;
}
public static AuthType getByValue(String value) {
return lookup.get(value);
}
}
public enum AppType {
@ -136,6 +148,14 @@ public class ClientDetailsEntity implements ClientDetails {
private final String value;
// map to aid reverse lookup
private static final Map<String, AppType> lookup = new HashMap<String, AppType>();
static {
for (AppType a : AppType.values()) {
lookup.put(a.getValue(), a);
}
}
AppType(String value) {
this.value = value;
}
@ -143,6 +163,10 @@ public class ClientDetailsEntity implements ClientDetails {
public String getValue() {
return value;
}
public static AppType getByValue(String value) {
return lookup.get(value);
}
}
/**