public class TapestryJsonProvider extends AbstractJsonProvider
| Modifier and Type | Field and Description |
|---|---|
static TapestryJsonProvider |
INSTANCE |
UNDEFINED| Constructor and Description |
|---|
TapestryJsonProvider() |
| Modifier and Type | Method and Description |
|---|---|
Object |
createArray()
Creates a provider specific json array
|
Object |
createMap()
Creates a provider specific json object
|
Object |
getArrayIndex(Object obj,
int idx)
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
|
Object |
parse(InputStream jsonStream,
String charset)
Parse the given json string
|
Object |
parse(String json)
Parse the given json string
|
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
|
String |
toJson(Object obj)
Convert given json object to a json string
|
getArrayIndex, removeProperty, toIterable, unwrappublic static final TapestryJsonProvider INSTANCE
public Object parse(String json) throws InvalidJsonException
JsonProviderjson - json string to parseInvalidJsonExceptionpublic Object parse(InputStream jsonStream, String charset) throws InvalidJsonException
JsonProviderjsonStream - input stream to parsecharset - charset to useInvalidJsonExceptionpublic String toJson(Object obj)
JsonProviderobj - object to transformpublic Object createArray()
JsonProviderpublic Object createMap()
JsonProviderpublic void setProperty(Object obj, Object key, Object value)
AbstractJsonProvidersetProperty in interface JsonProvidersetProperty in class AbstractJsonProviderobj - an objectkey - a String keyvalue - the value to setpublic boolean isMap(Object obj)
AbstractJsonProviderisMap in interface JsonProviderisMap in class AbstractJsonProviderobj - object to checkpublic Object getArrayIndex(Object obj, int idx)
AbstractJsonProvidergetArrayIndex in interface JsonProvidergetArrayIndex in class AbstractJsonProviderobj - an arrayidx - indexpublic Collection<String> getPropertyKeys(Object obj)
AbstractJsonProvidergetPropertyKeys in interface JsonProvidergetPropertyKeys in class AbstractJsonProviderobj - an objectpublic Object getMapValue(Object obj, String key)
AbstractJsonProvidergetMapValue in interface JsonProvidergetMapValue in class AbstractJsonProviderobj - a mapkey - property keyJsonProvider.UNDEFINED for missing propertiespublic int length(Object obj)
AbstractJsonProviderlength in interface JsonProviderlength in class AbstractJsonProviderobj - an array or an objectpublic boolean isArray(Object obj)
AbstractJsonProviderisArray in interface JsonProviderisArray in class AbstractJsonProviderobj - object to checkpublic void setArrayIndex(Object array, int index, Object newValue)
JsonProvidersetArrayIndex in interface JsonProvidersetArrayIndex in class AbstractJsonProviderarray - an arrayindex - indexnewValue - the new valueCopyright © 2016. All rights reserved.