forked from TuxCoding/FastLogin
Convert config values to string if casting fails
This commit is contained in:
@ -13,6 +13,11 @@ public class SharedConfig {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T get(String path, T def) {
|
public <T> T get(String path, T def) {
|
||||||
Object val = configValues.get(path);
|
Object val = configValues.get(path);
|
||||||
|
|
||||||
|
if (def instanceof String) {
|
||||||
|
return (T) String.valueOf(val);
|
||||||
|
}
|
||||||
|
|
||||||
return ( val != null ) ? (T) val : def;
|
return ( val != null ) ? (T) val : def;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user