diff options
author | sk89q <the.sk89q@gmail.com> | 2011-01-16 13:28:59 -0800 |
---|---|---|
committer | sk89q <the.sk89q@gmail.com> | 2011-01-16 13:28:59 -0800 |
commit | 816da0fb6191675d46f280354e819993a91e640e (patch) | |
tree | 96e4a2755b4ff247434f9822aa354401f310c101 /src/main/java/org | |
parent | 8eeb293d2bc01f02186e75b167c92872908b0fc8 (diff) | |
download | bukkit-816da0fb6191675d46f280354e819993a91e640e.tar bukkit-816da0fb6191675d46f280354e819993a91e640e.tar.gz bukkit-816da0fb6191675d46f280354e819993a91e640e.tar.lz bukkit-816da0fb6191675d46f280354e819993a91e640e.tar.xz bukkit-816da0fb6191675d46f280354e819993a91e640e.zip |
Added Configuration.getKeys().
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/util/config/ConfigurationNode.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/util/config/ConfigurationNode.java b/src/main/java/org/bukkit/util/config/ConfigurationNode.java index 60956c13..ead13a7c 100644 --- a/src/main/java/org/bukkit/util/config/ConfigurationNode.java +++ b/src/main/java/org/bukkit/util/config/ConfigurationNode.java @@ -149,6 +149,25 @@ public abstract class ConfigurationNode { return o;
}
}
+
+ /**
+ * Get a list of keys at a location. If the map at the particular location
+ * does not exist or it is not a map, null will be returned.
+ *
+ * @param path path to node (dot notation)
+ * @return list of keys
+ */
+ @SuppressWarnings("unchecked")
+ public List<String> getKeys(String path) {
+ Object o = getProperty(path);
+ if (o == null) {
+ return null;
+ } else if (o instanceof Map) {
+ return new ArrayList<String>(((Map<String,Object>)o).keySet());
+ } else {
+ return null;
+ }
+ }
/**
* Gets a list of objects at a location. If the list is not defined,
|