MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / toString

Method toString

src/main/java/net/minecraft/util/JsonUtils.java:297–336  ·  view source on GitHub ↗

Gets a human-readable description of the given JsonElement's type. For example: "a number (4)"

(JsonElement p_151222_0_)

Source from the content-addressed store, hash-verified

295 * Gets a human-readable description of the given JsonElement's type. For example: "a number (4)"
296 */
297 public static String toString(JsonElement p_151222_0_)
298 {
299 String s = org.apache.commons.lang3.StringUtils.abbreviateMiddle(String.valueOf(p_151222_0_), "...", 10);
300
301 if (p_151222_0_ == null)
302 {
303 return "null (missing)";
304 }
305 else if (p_151222_0_.isJsonNull())
306 {
307 return "null (json)";
308 }
309 else if (p_151222_0_.isJsonArray())
310 {
311 return "an array (" + s + ")";
312 }
313 else if (p_151222_0_.isJsonObject())
314 {
315 return "an object (" + s + ")";
316 }
317 else
318 {
319 if (p_151222_0_.isJsonPrimitive())
320 {
321 JsonPrimitive jsonprimitive = p_151222_0_.getAsJsonPrimitive();
322
323 if (jsonprimitive.isNumber())
324 {
325 return "a number (" + s + ")";
326 }
327
328 if (jsonprimitive.isBoolean())
329 {
330 return "a boolean (" + s + ")";
331 }
332 }
333
334 return s;
335 }
336 }
337}

Callers 6

getStringMethod · 0.95
getBooleanMethod · 0.95
getFloatMethod · 0.95
getIntMethod · 0.95
getJsonObjectMethod · 0.95
getJsonArrayMethod · 0.95

Calls 3

isJsonArrayMethod · 0.80
isJsonPrimitiveMethod · 0.80
isBooleanMethod · 0.80

Tested by

no test coverage detected