fastjson文档解读——下篇
来源:互联网 发布:事业单位选调考试软件 编辑:程序博客网 时间:2024/06/18 14:52
com.alibaba.fastjson.JSONArray
有一些基本的数组操作方法,就像操作List数组一样操作JSONArray就可以。
添加元素:
void add(int index, Object element)
boolean add(Object e)
boolean addAll(Collection<? extendsObject> c)
boolean addAll(int index, Collection<?extends Object> c)
获取元素:
Object get(int index)
BigDecimal getBigDecimal(int index)
BigInteger getBigInteger(int index)
Boolean getBoolean(int index)
boolean getBooleanValue(int index)
Byte getByte(int index)
byte getByteValue(int index)
Type getComponentType()
Date getDate(int index)
Double getDouble(int index)
double getDoubleValue(int index)
Float getFloat(int index)
float getFloatValue(int index)
Integer getInteger(int index)
int getIntValue(int index)
JSONArray getJSONArray(int index)
JSONObject getJSONObject(int index)
Long getLong(int index)
long getLongValue(int index)
<T> T getObject(int index,Class<T> clazz)
Object getRelatedArray()
Short getShort(int index)
short getShortValue(int index)
Date getSqlDate(int index)
String getString(int index)
Timestamp getTimestamp(int index)
Iterator:
Iterator<Object> iterator()
int lastIndexOf(Object o)
ListIterator<Object> listIterator()
ListIterator<Object> listIterator(intindex)
删除:
Object remove(int index)
boolean remove(Object o)
boolean removeAll(Collection<?> c)
boolean retainAll(Collection<?> c)
其他重要方法:
void clear():清空数组。即遍历数组,移除其中所有的键值,并置为null。
Object clone():克隆。
Boolean contains(Object o):判断是否包含某个元素。
Boolean containsAll(Collection<?> c):判断是否包含某个集合
Boolean equals(Object obj):判断是否与所传对象相同。equals只比较值。
com.alibaba.fastjson.JSONObject
添加元素
Object put (String key, Object value)
void putAll(Map<? extends String,? extendsObject> m)
取值:
Object get(Object key)
BigDecimal getBigDecimal(String key)
BigInteger getBigInteger(String key)
Boolean getBoolean(String key)
boolean getBooleanValue(String key)
Byte getByte(String key)
byte[] getBytes(String key)
byte getByteValue(String key)
Date getDate(String key)
Double getDouble(String key)
double getDoubleValue(String key)
Float getFloat(String key)
float getFloatValue(String key)
Integer getInteger(String key)
int getIntValue(String key)
JSONArray getJSONArray(String key)
JSONObject getJSONObject(String key)
Long getLong(String key)
long getLongValue(String key)
<T> T getObject(Stringkey,Class<T> clazz)
Short getShort(String key)
short getShort(String key)
Date getSqlDate(String key)
String getString(String key)
Timestamp getTimestamp(String key)
删除:
Object remove (Object key)
其他重要方法:
void clear():清空
Object clone():克隆
boolean containsKey(Object key):是否包含某键
boolean containsValue(Object value):是否包含某值
set<map.Entry<String,Object>>entrySet():取键值对
boolean equals (Object obj):判断是否相等
int hashCode():返回JSONObject对象的hashCode
Object invoke(Object proxy, Method method,Object[] args):
boolean isEmpty():判断是否为空
Set<String> keyset():取键的集合
int size():JSONObject的大小
Collection <Object> values():取值的集合
- fastjson文档解读——下篇
- fastjson文档解读——上篇
- 晓之以理,不如动之以情——新书《以大致胜》解读(下篇)
- FastJson源码解读
- JSON——fastjson
- FastJson使用文档
- mako源码解读(2)——文档解析
- webpack其实没那么可怕——官方文档解读
- ibatis 使用文档 (下篇)
- ibatis使用文档(下篇)
- json解析——fastjson
- 黑马程序员——GUI2:下篇
- OS X 快捷键——下篇
- 实战解读阿里fastjson基本操作
- fastjson——如何处理反斜杠
- fastjson扩展——多态支持
- fastJson——使用,过滤,多级过滤
- TensorFlow 官方文档中文版解读之2——tf.sparse_to_dense的用法
- 备用自动更新列表
- 通过Filter解决跨域问题,可以跨多个域,域可以通过@Value注解取
- 2.4信道复用技术
- mysql存储过程动态执行sql
- 追梦人
- fastjson文档解读——下篇
- 我所理解的设计模式(C++实现)——观察者模式(Observer Pattern)
- WPF中命令的绑定
- 随意细解:UI -- 可视化设计
- 一个信鸽推送的简易demo
- IOS-33-报错:No matching provisioning profiles found: No provisioning profiles matching a
- TED创业的要素
- Eclipse启动时报错:No java virtual machine
- Android FTP服务器搭建与文件上传及下载