com.jayway.jsonpath
Interface JsonModel.ObjectOps

Enclosing class:
JsonModel

public static interface JsonModel.ObjectOps

Operations that can be performed on Json objects (Maps)


Method Summary
 boolean containsKey(String key)
           
 Object get(String key)
           
 Double getDouble(String key)
          Tries to convert the value associated with the key to an Double
 Integer getInteger(String key)
          Tries to convert the value associated with the key to an Integer
 Long getLong(String key)
          Tries to convert the value associated with the key to an Long
 String getString(String key)
          Tries to convert the value associated with the key to an String
 Map<String,Object> getTarget()
          Returns the operation target
 JsonModel.ObjectOps put(String key, Object value)
           
 JsonModel.ObjectOps putAll(Map<String,Object> map)
           
 JsonModel.ObjectOps putIfAbsent(String key, Object value)
          Adds the value to the target map if it is not already present
 JsonModel.ObjectOps remove(String key)
           
<T> T
to(Class<T> targetClass)
          Map the target of this JsonModel.ObjectOps to the provided class
 JsonModel.ObjectOps transform(Transformer<Map<String,Object>> transformer)
          Allows transformations of the target object.
 

Method Detail

getTarget

Map<String,Object> getTarget()
Returns the operation target

Returns:
the operation target

containsKey

boolean containsKey(String key)
See Also:
Map.containsKey(Object)

put

JsonModel.ObjectOps put(String key,
                        Object value)
See Also:
Map.put(Object, Object)

putIfAbsent

JsonModel.ObjectOps putIfAbsent(String key,
                                Object value)
Adds the value to the target map if it is not already present

Parameters:
key - the key
value - the value
Returns:
this JsonModel.ObjectOps

get

Object get(String key)
See Also:
Map.get(Object)

getInteger

Integer getInteger(String key)
Tries to convert the value associated with the key to an Integer

Parameters:
key - the key
Returns:
converted value

getLong

Long getLong(String key)
Tries to convert the value associated with the key to an Long

Parameters:
key - the key
Returns:
converted value

getDouble

Double getDouble(String key)
Tries to convert the value associated with the key to an Double

Parameters:
key - the key
Returns:
converted value

getString

String getString(String key)
Tries to convert the value associated with the key to an String

Parameters:
key - the key
Returns:
converted value

putAll

JsonModel.ObjectOps putAll(Map<String,Object> map)
See Also:
Map.putAll(java.util.Map)

remove

JsonModel.ObjectOps remove(String key)
See Also:
Map.remove(Object)

transform

JsonModel.ObjectOps transform(Transformer<Map<String,Object>> transformer)
Allows transformations of the target object. the target for this JsonModel.ObjectOps will be be replaced with the Object returned by the Transformer.transform(Object)

Parameters:
transformer - the transformer to use
Returns:
this JsonModel.ObjectOps

to

<T> T to(Class<T> targetClass)
Map the target of this JsonModel.ObjectOps to the provided class

Type Parameters:
T - template class
Parameters:
targetClass - class to convert the target object to
Returns:
the mapped model


Copyright © 2011-2012. All Rights Reserved.