com.gentics.api.lib.resolving
Class JSONResolvable

java.lang.Object
  extended by com.gentics.api.lib.resolving.JSONResolvable
All Implemented Interfaces:
Resolvable

public class JSONResolvable
extends java.lang.Object
implements Resolvable

Bridge class between JSONObject and Resolvable. Wraps an instance of JSONObject and resolves properties.


Field Summary
protected  org.json.JSONObject jsonObject
          wapped JSON object
 
Constructor Summary
JSONResolvable(org.json.JSONObject jsonObject)
          Create an instance of the JSON Resolvable wrapper
 
Method Summary
 boolean canResolve()
          Check whether the resolvable is capable of resolving properties right now.
 java.lang.Object get(java.lang.String key)
          Get the property named by key or null if the property does not exist or is not set.
 java.lang.Object getProperty(java.lang.String key)
          Get the property named by key or null if the property does not exist or is not set.
protected static java.lang.Object transformValue(java.lang.Object value)
          Helper method to transform the given value from JSON to Resolvable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jsonObject

protected org.json.JSONObject jsonObject
wapped JSON object

Constructor Detail

JSONResolvable

public JSONResolvable(org.json.JSONObject jsonObject)
Create an instance of the JSON Resolvable wrapper

Parameters:
jsonObject - wrapped JSON object
Method Detail

canResolve

public boolean canResolve()
Description copied from interface: Resolvable
Check whether the resolvable is capable of resolving properties right now.
if this method returns false all calls to Resolvable.getProperty(String) or Resolvable.get(String) will return null.

Specified by:
canResolve in interface Resolvable
Returns:
true when the resolvable can resolve properties. false if not

get

public java.lang.Object get(java.lang.String key)
Description copied from interface: Resolvable
Get the property named by key or null if the property does not exist or is not set.

Specified by:
get in interface Resolvable
Parameters:
key - key of the property
Returns:
value of the property or null

getProperty

public java.lang.Object getProperty(java.lang.String key)
Description copied from interface: Resolvable
Get the property named by key or null if the property does not exist or is not set. Alias for Resolvable.get(String).

Specified by:
getProperty in interface Resolvable
Parameters:
key - key of the property
Returns:
value of the property or null

transformValue

protected static java.lang.Object transformValue(java.lang.Object value)
                                          throws org.json.JSONException
Helper method to transform the given value from JSON to Resolvable

Parameters:
value - value to transform
Returns:
transformed value
Throws:
org.json.JSONException


Copyright © 2013 Gentics Software GmbH. All Rights Reserved.