Gets a human-readable description of the given JsonElement's type. For example: "a number (4)"
(JsonElement p_151222_0_)
| 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 | } |
no test coverage detected