MCPcopy Index your code
hub / github.com/EASY233/BpScan / getValueByKey

Method getValueByKey

BPScan/src/main/java/burp/common/YamlReader.java:46–66  ·  view source on GitHub ↗

获取yaml属性 可通过 "." 循环调用 例如这样调用: YamlReader.getInstance().getValueByKey("a.b.c.d") @param key @return

(String key)

Source from the content-addressed store, hash-verified

44 * @return
45 */
46 public Object getValueByKey(String key) {
47 String separator = ".";
48 String[] separatorKeys = null;
49 if (key.contains(separator)) {
50 separatorKeys = key.split("\\.");
51 } else {
52 return properties.get(key);
53 }
54 Map<String, Map<String, Object>> finalValue = new HashMap<>();
55 for (int i = 0; i < separatorKeys.length - 1; i++) {
56 if (i == 0) {
57 finalValue = (Map) properties.get(separatorKeys[i]);
58 continue;
59 }
60 if (finalValue == null) {
61 break;
62 }
63 finalValue = (Map) finalValue.get(separatorKeys[i]);
64 }
65 return finalValue == null ? null : finalValue.get(separatorKeys[separatorKeys.length - 1]);
66 }
67
68 public String getString(String key) {
69 return String.valueOf(this.getValueByKey(key));

Callers 6

getStringMethod · 0.95
getBooleanMethod · 0.95
getIntegerMethod · 0.95
getDoubleMethod · 0.95
getStringListMethod · 0.95
getLinkedHashMapMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected