public abstract class AbstractJsonProvider extends Object implements JsonProvider
UNDEFINED
Constructor and Description |
---|
AbstractJsonProvider() |
Modifier and Type | Method and Description |
---|---|
Object |
getArrayIndex(Object obj,
int idx)
Extracts a value from an array
|
Object |
getArrayIndex(Object obj,
int idx,
boolean unwrap)
Extracts a value from an array
|
Object |
getMapValue(Object obj,
String key)
Extracts a value from an map
|
Collection<String> |
getPropertyKeys(Object obj)
Returns the keys from the given object
|
boolean |
isArray(Object obj)
checks if object is an array
|
boolean |
isMap(Object obj)
checks if object is a map (i.e.
|
int |
length(Object obj)
Get the length of an array or object
|
void |
removeProperty(Object obj,
Object key)
Removes a value in an object or array
|
void |
setArrayIndex(Object array,
int index,
Object newValue)
Sets a value in an array.
|
void |
setProperty(Object obj,
Object key,
Object value)
Sets a value in an object
|
Iterable<? extends Object> |
toIterable(Object obj)
Converts given array to an
Iterable |
Object |
unwrap(Object obj)
Extracts a value from a wrapper object.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createArray, createMap, parse, parse, toJson
public boolean isArray(Object obj)
isArray
in interface JsonProvider
obj
- object to checkpublic Object getArrayIndex(Object obj, int idx)
getArrayIndex
in interface JsonProvider
obj
- an arrayidx
- indexpublic final Object getArrayIndex(Object obj, int idx, boolean unwrap)
JsonProvider
getArrayIndex
in interface JsonProvider
obj
- an arrayidx
- indexunwrap
- should provider specific data type be unwrappedpublic void setArrayIndex(Object array, int index, Object newValue)
JsonProvider
setArrayIndex
in interface JsonProvider
array
- an arrayindex
- indexnewValue
- the new valuepublic Object getMapValue(Object obj, String key)
getMapValue
in interface JsonProvider
obj
- a mapkey
- property keyJsonProvider.UNDEFINED
for missing propertiespublic void setProperty(Object obj, Object key, Object value)
setProperty
in interface JsonProvider
obj
- an objectkey
- a String keyvalue
- the value to setpublic void removeProperty(Object obj, Object key)
removeProperty
in interface JsonProvider
obj
- an array or an objectkey
- a String key or a numerical index to removepublic boolean isMap(Object obj)
isMap
in interface JsonProvider
obj
- object to checkpublic Collection<String> getPropertyKeys(Object obj)
getPropertyKeys
in interface JsonProvider
obj
- an objectpublic int length(Object obj)
length
in interface JsonProvider
obj
- an array or an objectpublic Iterable<? extends Object> toIterable(Object obj)
Iterable
toIterable
in interface JsonProvider
obj
- an arraypublic Object unwrap(Object obj)
JsonProvider
unwrap
in interface JsonProvider
obj
- a value holder objectCopyright © 2022. All rights reserved.