Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. package com.github.games647.fastlogin.core;
  2.  
  3. import java.util.Map;
  4.  
  5. public class SharedConfig {
  6.  
  7. private final Map<String, Object> configValues;
  8.  
  9. public SharedConfig(Map<String, Object> configValues) {
  10. this.configValues = configValues;
  11. }
  12.  
  13. @SuppressWarnings("unchecked")
  14. public <T> T get(String path, T def) {
  15. Object val = configValues.get(path);
  16.  
  17. if (def instanceof String) {
  18. return (T) String.valueOf(val);
  19. }
  20.  
  21. return ( val != null ) ? (T) val : def;
  22. }
  23.  
  24. public <T> T get(String path) {
  25. return get(path, null);
  26. }
  27.  
  28. public Map<String, Object> getConfigValues() {
  29. return configValues;
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement