|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.isis.viewer.restfulobjects.applib.JsonRepresentation
public class JsonRepresentation
A wrapper around JsonNode that provides some additional helper
methods.
| Nested Class Summary | |
|---|---|
static interface |
JsonRepresentation.HasExtensions
|
static interface |
JsonRepresentation.HasLinks
|
static interface |
JsonRepresentation.LinksToSelf
|
| Field Summary | |
|---|---|
protected org.codehaus.jackson.JsonNode |
jsonNode
|
| Constructor Summary | |
|---|---|
JsonRepresentation(org.codehaus.jackson.JsonNode jsonNode)
|
|
| Method Summary | ||
|---|---|---|
void |
arrayAdd(boolean value)
|
|
void |
arrayAdd(double value)
|
|
void |
arrayAdd(float value)
|
|
void |
arrayAdd(int value)
|
|
void |
arrayAdd(org.codehaus.jackson.JsonNode value)
|
|
void |
arrayAdd(JsonRepresentation value)
|
|
void |
arrayAdd(long value)
|
|
void |
arrayAdd(Object value)
|
|
void |
arrayAdd(String value)
|
|
JsonRepresentation |
arrayGet(int i)
|
|
Iterable<JsonRepresentation> |
arrayIterable()
|
|
|
arrayIterable(Class<T> requiredType)
|
|
Iterator<JsonRepresentation> |
arrayIterator()
|
|
|
arrayIterator(Class<T> requiredType)
|
|
void |
arraySetElementAt(int i,
JsonRepresentation objectRepr)
|
|
|
as(Class<T> cls)
Convenience to simply "downcast". |
|
String |
asArg()
|
|
JsonRepresentation |
asArray()
|
|
protected org.codehaus.jackson.node.ArrayNode |
asArrayNode()
Convert underlying representation into an array. |
|
BigDecimal |
asBigDecimal()
|
|
BigInteger |
asBigInteger()
|
|
Boolean |
asBoolean()
|
|
Double |
asDouble()
|
|
InputStream |
asInputStream()
|
|
Integer |
asInt()
|
|
org.codehaus.jackson.JsonNode |
asJsonNode()
|
|
LinkRepresentation |
asLink()
|
|
Long |
asLong()
|
|
JsonRepresentation |
asMap()
|
|
JsonRepresentation |
asNull()
|
|
protected org.codehaus.jackson.node.ObjectNode |
asObjectNode()
Convert underlying representation into an object (map). |
|
String |
asString()
|
|
String |
asUrlEncoded()
|
|
JsonRepresentation |
ensureArray()
A reciprocal of the behaviour of the automatic dereferencing of arrays that occurs when there is only a single instance. |
|
JsonRepresentation |
getArray(String path)
|
|
JsonRepresentation |
getArrayEnsured(String path)
|
|
BigDecimal |
getBigDecimal(String path)
|
|
BigInteger |
getBigInteger(String path)
|
|
Boolean |
getBoolean(String path)
|
|
Double |
getDouble(String path)
|
|
Integer |
getInt(String path)
|
|
LinkRepresentation |
getLink(String path)
|
|
Long |
getLong(String path)
|
|
JsonRepresentation |
getMap(String path)
|
|
JsonRepresentation |
getNull(String path)
Either returns a JsonRepresentation that indicates that the
wrapped node has null value (ie
isNull()), or returns null if there
was no node with the provided path. |
|
JsonRepresentation |
getRepresentation(String pathTemplate,
Object... args)
|
|
String |
getString(String path)
|
|
boolean |
isArray()
|
|
boolean |
isArray(String path)
|
|
boolean |
isBigDecimal()
|
|
boolean |
isBigDecimal(String path)
|
|
boolean |
isBigInteger()
|
|
boolean |
isBigInteger(String path)
|
|
boolean |
isBoolean()
|
|
boolean |
isBoolean(String path)
|
|
boolean |
isDouble()
|
|
boolean |
isDouble(String path)
|
|
boolean |
isInt()
|
|
boolean |
isInt(String path)
|
|
boolean |
isLink()
|
|
boolean |
isLink(org.codehaus.jackson.JsonNode node)
|
|
boolean |
isLink(String path)
|
|
boolean |
isLong()
|
|
boolean |
isLong(String path)
|
|
boolean |
isMap()
|
|
boolean |
isMap(String path)
|
|
boolean |
isNull()
|
|
Boolean |
isNull(String path)
Indicates that the wrapped node has null value (ie isNull()), or returns null if there
was no node with the provided path. |
|
boolean |
isString()
|
|
boolean |
isString(String path)
|
|
boolean |
isValue()
Node is a value (nb: could be null). |
|
boolean |
mapHas(String key)
|
|
Iterable<Map.Entry<String,JsonRepresentation>> |
mapIterable()
|
|
Iterator<Map.Entry<String,JsonRepresentation>> |
mapIterator()
|
|
void |
mapPut(String key,
boolean value)
|
|
void |
mapPut(String key,
double value)
|
|
void |
mapPut(String key,
float value)
|
|
void |
mapPut(String key,
int value)
|
|
void |
mapPut(String key,
org.codehaus.jackson.JsonNode value)
|
|
void |
mapPut(String key,
JsonRepresentation value)
|
|
void |
mapPut(String key,
List<Object> value)
|
|
void |
mapPut(String key,
long value)
|
|
void |
mapPut(String key,
Object value)
|
|
void |
mapPut(String key,
String value)
|
|
LinkRepresentation |
mapValueAsLink()
Convert a representation that contains a single node representing a link into a LinkRepresentation. |
|
static JsonRepresentation |
newArray()
|
|
static JsonRepresentation |
newArray(int initialSize)
|
|
static JsonRepresentation |
newMap(String... keyValuePairs)
|
|
int |
size()
|
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final org.codehaus.jackson.JsonNode jsonNode
| Constructor Detail |
|---|
public JsonRepresentation(org.codehaus.jackson.JsonNode jsonNode)
| Method Detail |
|---|
public static JsonRepresentation newMap(String... keyValuePairs)
public static JsonRepresentation newArray()
public static JsonRepresentation newArray(int initialSize)
public org.codehaus.jackson.JsonNode asJsonNode()
public int size()
public boolean isValue()
null).
public JsonRepresentation getRepresentation(String pathTemplate,
Object... args)
public boolean isArray(String path)
public boolean isArray()
public JsonRepresentation getArray(String path)
public JsonRepresentation asArray()
public JsonRepresentation getArrayEnsured(String path)
public boolean isMap(String path)
public boolean isMap()
public JsonRepresentation getMap(String path)
public JsonRepresentation asMap()
public boolean isBoolean(String path)
public boolean isBoolean()
public Boolean getBoolean(String path)
public Boolean asBoolean()
public boolean isBigInteger(String path)
public boolean isBigInteger()
public BigInteger getBigInteger(String path)
public BigInteger asBigInteger()
public boolean isBigDecimal(String path)
public boolean isBigDecimal()
public BigDecimal getBigDecimal(String path)
public BigDecimal asBigDecimal()
public boolean isInt(String path)
public boolean isInt()
public Integer getInt(String path)
public Integer asInt()
public boolean isLong(String path)
public boolean isLong()
public Long getLong(String path)
public Long asLong()
public boolean isDouble(String path)
public boolean isDouble()
public Double getDouble(String path)
public Double asDouble()
public boolean isString(String path)
public boolean isString()
public String getString(String path)
public String asString()
public String asArg()
public boolean isLink()
public boolean isLink(String path)
public boolean isLink(org.codehaus.jackson.JsonNode node)
public LinkRepresentation getLink(String path)
public LinkRepresentation asLink()
public boolean isNull()
public Boolean isNull(String path)
isNull()), or returns null if there
was no node with the provided path.
public JsonRepresentation getNull(String path)
JsonRepresentation that indicates that the
wrapped node has null value (ie
isNull()), or returns null if there
was no node with the provided path.
public JsonRepresentation asNull()
public LinkRepresentation mapValueAsLink()
LinkRepresentation.
public InputStream asInputStream()
protected org.codehaus.jackson.node.ArrayNode asArrayNode()
protected org.codehaus.jackson.node.ObjectNode asObjectNode()
public <T extends JsonRepresentation> T as(Class<T> cls)
In fact, the method creates a new instance of the specified type, which
shares the underlying jsonNode.
public String asUrlEncoded()
public void arrayAdd(Object value)
public void arrayAdd(JsonRepresentation value)
public void arrayAdd(String value)
public void arrayAdd(org.codehaus.jackson.JsonNode value)
public void arrayAdd(long value)
public void arrayAdd(int value)
public void arrayAdd(double value)
public void arrayAdd(float value)
public void arrayAdd(boolean value)
public Iterable<JsonRepresentation> arrayIterable()
public <T> Iterable<T> arrayIterable(Class<T> requiredType)
public Iterator<JsonRepresentation> arrayIterator()
public <T> Iterator<T> arrayIterator(Class<T> requiredType)
public JsonRepresentation arrayGet(int i)
public void arraySetElementAt(int i,
JsonRepresentation objectRepr)
public boolean mapHas(String key)
public void mapPut(String key,
List<Object> value)
public void mapPut(String key,
Object value)
public void mapPut(String key,
JsonRepresentation value)
public void mapPut(String key,
String value)
public void mapPut(String key,
org.codehaus.jackson.JsonNode value)
public void mapPut(String key,
long value)
public void mapPut(String key,
int value)
public void mapPut(String key,
double value)
public void mapPut(String key,
float value)
public void mapPut(String key,
boolean value)
public Iterable<Map.Entry<String,JsonRepresentation>> mapIterable()
public Iterator<Map.Entry<String,JsonRepresentation>> mapIterator()
public JsonRepresentation ensureArray()
toJsonNode(List)public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||