public class ONode extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
ONode |
add(Object val)
返回自己,为数组添加子节点
|
<T> ONode |
addAll(Collection<T> ary)
返回自己,尝试添加一个集合
|
<T> ONode |
addAll(Collection<T> ary,
Act2<ONode,T> handler)
返回自己,尝试添加一个集合,handler里获取的是自动产生的子节点
|
ONode |
addAll(ONode ary)
返回自己,尝试添加数组型节点
|
ONode |
addNew()
返回数组子节点,创建数据新的子节点
|
void |
addNode(ONode val)
添加节点(需要手工提前初始化数组类型)
|
ONode |
asArray() |
List<ONode> |
asList() |
Map<String,ONode> |
asMap() |
ONode |
asNull() |
ONode |
asObject() |
void |
attrForeach(BiConsumer<String,String> consumer) |
String |
attrGet(String key)
获取特性
|
void |
attrSet(String key,
String val)
设置特性
|
ONode |
cfg(Constants config) |
void |
clear()
清空子节点
|
boolean |
contains(String name) |
int |
count() |
static <T> T |
deserialize(String source,
Class<?> clz)
反序列化为 Object
|
static <T> T |
deserialize(String source,
Class<?> clz,
Constants config) |
ONode |
exp(Act1<ONode> fun)
返回自己,构建表达式
|
void |
forEach(BiConsumer<String,ONode> consumer)
遍历对象
|
void |
forEach(Consumer<ONode> consumer)
遍历数组
|
ONode |
from(Object source)
返回自己(从来源处加载数据)
|
ONode |
get(int index)
获取数组项
|
ONode |
get(String key)
返回对象子节点
|
boolean |
getBoolean()
获取 boolean 值
|
char |
getChar() |
ONodeData |
getData()
获取内部数据
|
Date |
getDate()
获取 date 值
|
double |
getDouble()
获取 double 值
|
double |
getDouble(int scale)
获取 double 值
|
float |
getFloat() |
int |
getInt()
获取 int 值
|
long |
getLong()
获取 long 值
|
ONode |
getNew(String key) |
short |
getShort() |
String |
getString()
获取 string 值
|
boolean |
isArray() |
boolean |
isNull() |
boolean |
isObject() |
boolean |
isValue() |
static ONode |
map(Object source)
加载来源:string or object (返回可能为null 或有异常)
|
static ONode |
map(Object source,
Constants config) |
ONodeType |
nodeType() |
void |
remove(String key)
移除对象子节点(搞不清楚是自身还是被移除的,所以不返回)
|
void |
removeAt(int index)
移除数组子节点(搞不清楚是自身还是被移除的,所以不返回)
|
static String |
serialize(Object source)
序列化为 json string
|
static String |
serialize(Object source,
Constants config) |
ONode |
set(String key,
Object val)
返回自己,设置对象子节点
|
<T> ONode |
setAll(Map<String,T> map)
返回自己,尝试添加一个集合
|
<T> ONode |
setAll(Map<String,T> map,
Act2<ONode,T> handler)
返回自己,尝试添加一个集合,handler里获取的是自动产生的子节点
|
ONode |
setAll(ONode obj)
返回自己,尝试添加对象型节点
|
void |
setNode(String key,
ONode val)
设置对象子节点(需要手工提前初始化对象类型)
|
<T> T |
toBean(Class<T> clz)
将当前ONode 转为 Object
|
Object |
toData()
将当前ONode 转为 Map or List or val
|
String |
toJson()
将当前ONode 转为 json string
|
String |
toString() |
OValue |
val()
获取值数据
|
ONode |
val(Object val)
节点赋值(搞不清楚是自身还是被新值,所以不返回)
|
static String |
version() |
public ONode()
public ONode(Constants cfg)
public static String version()
public ONode asObject()
public ONode asArray()
public ONode asNull()
public ONodeData getData()
public ONodeType nodeType()
public OValue val()
public boolean contains(String name)
public String getString()
public short getShort()
public int getInt()
public boolean getBoolean()
public long getLong()
public Date getDate()
public float getFloat()
public double getDouble()
public double getDouble(int scale)
public char getChar()
public <T> ONode setAll(Map<String,T> map, Act2<ONode,T> handler)
public void remove(String key)
public void clear()
public ONode get(int index)
public void removeAt(int index)
public ONode addNew()
public void addNode(ONode val)
public <T> ONode addAll(Collection<T> ary)
public <T> ONode addAll(Collection<T> ary, Act2<ONode,T> handler)
public boolean isNull()
public boolean isValue()
public boolean isObject()
public boolean isArray()
public int count()
public void forEach(BiConsumer<String,ONode> consumer)
public void attrForeach(BiConsumer<String,String> consumer)
public String toJson()
public Object toData()
public <T> T toBean(Class<T> clz)
public static String serialize(Object source) throws Exception
Exceptionpublic static String serialize(Object source, Constants config) throws Exception
Exceptionpublic static <T> T deserialize(String source, Class<?> clz) throws Exception
ExceptionCopyright © 2019. All rights reserved.