public class JSONPrimitive extends Object implements Wrapper<Object>, JSON
| Constructor and Description |
|---|
JSONPrimitive(Object value,
JSONConfig config)
构造
|
JSONPrimitive(Object value,
JSONFactory factory)
构造
|
| Modifier and Type | Method and Description |
|---|---|
JSONFactory |
getFactory()
获得JSON工厂类
|
Object |
getRaw()
获取原始对象
|
Object |
getValue()
获取值
|
void |
increment()
|
boolean |
isBoolean()
是否为布尔类型
|
boolean |
isNumber()
是否为数字类型
|
boolean |
isString()
是否为字符串类型
|
static boolean |
isTypeForJSONPrimitive(Class<?> type)
判断给定类是否可以转为JSONPrimitive类型
|
static boolean |
isTypeForJSONPrimitive(Object value)
判断给定对象是否可以转为JSONPrimitive类型
|
JSONPrimitive |
setValue(Object value)
设置值
|
int |
size()
JSON大小,对于JSONObject,是键值对的多少,JSONArray则是元素的个数,JSON原始数据为1
|
String |
toString() |
void |
write(JSONWriter writer)
将JSON内容写入Writer
Warning: This method assumes that the data structure is acyclical. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitasJSONArray, asJSONObject, asJSONPrimitive, config, getByPath, getByPath, getObjByPath, isEmpty, putByPath, toBean, toJSONString, toJSONString, toStringPrettypublic JSONPrimitive(Object value, JSONConfig config)
value - 值config - 配置项public JSONPrimitive(Object value, JSONFactory factory)
value - 值factory - 配置项public static boolean isTypeForJSONPrimitive(Object value)
value - 值public static boolean isTypeForJSONPrimitive(Class<?> type)
type - 值public Object getValue()
public JSONPrimitive setValue(Object value)
value - 值public JSONFactory getFactory()
getFactory in interface JSONpublic boolean isNumber()
public boolean isBoolean()
public boolean isString()
public void increment()
JSONException - 非数字类型public int size()
JSONpublic void write(JSONWriter writer) throws JSONException
JSONwrite in interface JSONwriter - writerJSONException - JSON相关异常Copyright © 2025. All rights reserved.