Add a getKeys method to the Configuration API

This commit is contained in:
md_5 2014-06-24 16:59:15 +10:00
parent 923aa05d4a
commit b9f2f3cfae

View File

@ -1,6 +1,8 @@
package net.md_5.bungee.config; package net.md_5.bungee.config;
import com.google.common.collect.Sets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
@ -91,6 +93,16 @@ public final class Configuration
return new Configuration( (Map) ( get( path, ( def instanceof Map ) ? def : Collections.EMPTY_MAP ) ), ( defaults == null ) ? null : defaults.getSection( path ) ); return new Configuration( (Map) ( get( path, ( def instanceof Map ) ? def : Collections.EMPTY_MAP ) ), ( defaults == null ) ? null : defaults.getSection( path ) );
} }
/**
* Gets keys, not deep by default.
*
* @return top level keys for this section
*/
public Collection<String> getKeys()
{
return Sets.newLinkedHashSet( self.keySet() );
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
public byte getByte(String path) public byte getByte(String path)
{ {