MCPcopy Create free account
hub / github.com/BuildCraft/BuildCraft / getAsStringArray

Method getAsStringArray

common/buildcraft/lib/misc/JsonUtil.java:82–95  ·  view source on GitHub ↗
(JsonElement elem)

Source from the content-addressed store, hash-verified

80 }
81
82 public static String[] getAsStringArray(JsonElement elem) {
83 if (elem.isJsonArray()) {
84 JsonArray array = elem.getAsJsonArray();
85 String[] strings = new String[array.size()];
86 for (int i = 0; i < strings.length; i++) {
87 strings[i] = getAsString(array.get(i));
88 }
89 return strings;
90 } else if (elem.isJsonPrimitive()) {
91 return new String[] { getAsString(elem) };
92 } else {
93 throw new JsonSyntaxException("Needed an array of strings or a single string but got " + elem);
94 }
95 }
96
97 public static String[] getSubAsStringArray(JsonObject obj, String string) {
98 if (!obj.has(string)) {

Callers 1

getSubAsStringArrayMethod · 0.95

Calls 3

getAsStringMethod · 0.95
getMethod · 0.65
sizeMethod · 0.45

Tested by

no test coverage detected