mirror of
https://github.com/unmojang/authlib-injector.git
synced 2025-10-03 08:11:04 -04:00
移除JSONString
This commit is contained in:
parent
849c785249
commit
11c952d055
@ -1321,18 +1321,6 @@ public class JSONObject implements Serializable {
|
|||||||
if (value == null || value.equals(null)) {
|
if (value == null || value.equals(null)) {
|
||||||
return "null";
|
return "null";
|
||||||
}
|
}
|
||||||
if (value instanceof JSONString) {
|
|
||||||
Object object;
|
|
||||||
try {
|
|
||||||
object = ((JSONString) value).toJSONString();
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new JSONException(e);
|
|
||||||
}
|
|
||||||
if (object instanceof String) {
|
|
||||||
return (String) object;
|
|
||||||
}
|
|
||||||
throw new JSONException("Bad value from toJSONString: " + object);
|
|
||||||
}
|
|
||||||
if (value instanceof Number) {
|
if (value instanceof Number) {
|
||||||
return numberToString((Number) value);
|
return numberToString((Number) value);
|
||||||
}
|
}
|
||||||
@ -1372,7 +1360,7 @@ public class JSONObject implements Serializable {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (object instanceof JSONObject || object instanceof JSONArray
|
if (object instanceof JSONObject || object instanceof JSONArray
|
||||||
|| NULL.equals(object) || object instanceof JSONString
|
|| NULL.equals(object)
|
||||||
|| object instanceof Byte || object instanceof Character
|
|| object instanceof Byte || object instanceof Character
|
||||||
|| object instanceof Short || object instanceof Integer
|
|| object instanceof Short || object instanceof Integer
|
||||||
|| object instanceof Long || object instanceof Boolean
|
|| object instanceof Long || object instanceof Boolean
|
||||||
@ -1444,14 +1432,6 @@ public class JSONObject implements Serializable {
|
|||||||
writer.write(numberToString((Number) value));
|
writer.write(numberToString((Number) value));
|
||||||
} else if (value instanceof Boolean) {
|
} else if (value instanceof Boolean) {
|
||||||
writer.write(value.toString());
|
writer.write(value.toString());
|
||||||
} else if (value instanceof JSONString) {
|
|
||||||
Object o;
|
|
||||||
try {
|
|
||||||
o = ((JSONString) value).toJSONString();
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new JSONException(e);
|
|
||||||
}
|
|
||||||
writer.write(o != null ? o.toString() : quote(value.toString()));
|
|
||||||
} else {
|
} else {
|
||||||
quote(value.toString(), writer);
|
quote(value.toString(), writer);
|
||||||
}
|
}
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
package org.to2mbn.authlibinjector.internal.org.json;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The <code>JSONString</code> interface allows a <code>toJSONString()</code>
|
|
||||||
* method so that a class can change the behavior of
|
|
||||||
* <code>JSONObject.toString()</code>, <code>JSONArray.toString()</code>, and
|
|
||||||
* <code>JSONWriter.value(</code>Object<code>)</code>. The
|
|
||||||
* <code>toJSONString</code> method will be used instead of the default behavior
|
|
||||||
* of using the Object's <code>toString()</code> method and quoting the result.
|
|
||||||
*/
|
|
||||||
public interface JSONString {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The <code>toJSONString</code> method allows a class to produce its own
|
|
||||||
* JSON serialization.
|
|
||||||
*
|
|
||||||
* @return A strictly syntactically correct JSON text.
|
|
||||||
*/
|
|
||||||
public String toJSONString();
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user