reverse lookup for clientdetails utiltiy classes
parent
21ff134383
commit
29ac1a3a70
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue