@Override public List<String> getStringList( String path, List<String> defaultValues ) { final List<String> current = read(path, o -> (List<String>) o); if ( current == null ) return defaultValues; return current; }
@Override public Object getObject(String path) { return read( path, o->o ); }
@Override public String getString(String path) { final String propertyValue = System.getProperty(rootPath + path); if ( propertyValue != null ) return propertyValue; return read( path, o->(String)o ); }
@Override public boolean getBoolean(String path, boolean defaultValue) { final String propertyValue = System.getProperty(rootPath + path); if ( propertyValue != null ) return Boolean.valueOf(propertyValue); return read( path, o->ifNull( (Boolean)o , defaultValue) ); }
@Override public int getInteger(String path, int defaultValue) { final String propertyValue = System.getProperty(rootPath + path); if ( propertyValue != null ) return Integer.valueOf( propertyValue ); return read( path, o->ifNull( (Integer)o, defaultValue ) ); }
@Override public Config getConfig(String path) { final Map<String, Object> current = read(path, o->(Map<String,Object>)o); if ( current == null ) return null; return new MergeableConfig(current, rootPath + path + "."); }
@Override public List<Config> getConfigList(String path){ final List<Map<String, Object>> current = read(path, o->(List<Map<String,Object>>)o); if ( current == null ) return Collections.emptyList(); return current.stream().map( m -> new MergeableConfig(m, rootPath + path + ".") ).collect(Collectors.toList()); }
@Override public long getLong(String path, long defaultValue) { final String propertyValue = System.getProperty(rootPath + path); if ( propertyValue != null ) return Long.valueOf( propertyValue ); return read( path, o->ifNull( asLong(o), defaultValue ) ); }