public class ClientConfigurationUtil extends Object
ClientConfigurationFactory
to modularize operations on the JSON. Note that the "thiny" refers to a JSON idiom, viz.,
a configuration entry of the form {"topLevelKey":JSON} where JSON is either an array or json object.
These may be done at any level of the configuration file, so be sure to send in the right JSON object with the topLevelKey.
Created by Jeff Gaynor
on 8/30/17 at 3:37 PM
Modifier and Type | Field and Description |
---|---|
static String |
CLAIM_POST_PROCESSING_KEY |
static String |
CLAIM_PRE_PROCESSING_KEY |
static String |
COMMENT_KEY |
static String |
EXTRA_ATTRIBUTES_KEY |
static String |
RUNTIME_KEY |
static String |
SAVED_KEY |
Constructor and Description |
---|
ClientConfigurationUtil() |
Modifier and Type | Method and Description |
---|---|
static net.sf.json.JSONArray |
getComment(net.sf.json.JSONObject config)
Checks if the object has a comment flag.
|
static net.sf.json.JSONObject |
getExtraAttributes(net.sf.json.JSONObject config) |
protected static net.sf.json.JSONObject |
getProcessor(net.sf.json.JSONObject config,
String key,
String defaultFunctor)
Retrieve the processor named by key.
|
static net.sf.json.JSONObject |
getRuntime(net.sf.json.JSONObject config) |
static net.sf.json.JSONArray |
getRuntimeArg(net.sf.json.JSONObject config) |
static net.sf.json.JSONArray |
getThingies(String topLevelKey,
net.sf.json.JSONObject config,
String key)
Return the contents as a JSON array.
|
static net.sf.json.JSONObject |
getThingy(String topLevelKey,
net.sf.json.JSONObject config,
String key)
Return the
JSONObject for the given key. |
static boolean |
hasRuntime(net.sf.json.JSONObject config) |
static boolean |
hasThingy(String topLevelKey,
String key,
net.sf.json.JSONObject config)
Drills down a level to check if this thingy has the given object.
|
static boolean |
isSaved(net.sf.json.JSONObject config)
One of the few bits of state.
|
static void |
setComment(net.sf.json.JSONObject config,
net.sf.json.JSONArray comment) |
static void |
setComment(net.sf.json.JSONObject config,
String comment) |
static void |
setExtraAttributes(net.sf.json.JSONObject config,
net.sf.json.JSONObject attributes) |
static void |
setRuntime(net.sf.json.JSONObject config,
net.sf.json.JSONObject runtime) |
static void |
setSaved(net.sf.json.JSONObject config,
boolean value) |
static void |
setThingy(String topLevelKey,
net.sf.json.JSONObject config,
String key,
net.sf.json.JSON thingy)
Sets a JSON object at the given level.
|
public static final String CLAIM_POST_PROCESSING_KEY
public static final String CLAIM_PRE_PROCESSING_KEY
public static final String RUNTIME_KEY
public static final String SAVED_KEY
public static final String COMMENT_KEY
public static final String EXTRA_ATTRIBUTES_KEY
public static void setRuntime(net.sf.json.JSONObject config, net.sf.json.JSONObject runtime)
public static boolean hasRuntime(net.sf.json.JSONObject config)
protected static net.sf.json.JSONObject getProcessor(net.sf.json.JSONObject config, String key, String defaultFunctor)
LogicBlocks
.config
- key
- defaultFunctor
- public static net.sf.json.JSONObject getRuntime(net.sf.json.JSONObject config)
public static net.sf.json.JSONArray getRuntimeArg(net.sf.json.JSONObject config)
public static net.sf.json.JSONArray getThingies(String topLevelKey, net.sf.json.JSONObject config, String key)
JSONArray
.
Z= {"key0":{ "key1':X } }This method returns the JSON array
[X]
. Another example:
Z= {"key0":{ "key1':[X,Y,z] } }This method returns the JSON array
[X,y,z]
.topLevelKey
- config
- key
- public static net.sf.json.JSONObject getThingy(String topLevelKey, net.sf.json.JSONObject config, String key)
JSONObject
for the given key. This will fail if there is not a single object there,
Z= {"key0":{ "key1':X } }the call
getThingy("key0",Z,"key1")
returns X.topLevelKey
- config
- key
- public static void setThingy(String topLevelKey, net.sf.json.JSONObject config, String key, net.sf.json.JSON thingy)
Z= {"key0":{ ... stuff... } }The call
setThingy("key0:,Z,"key1",X)
results in
Z= {"key0":{ "key1':X, ... stuff ... } }This may involve replacing the value of key1 with X if there is already a value there.
topLevelKey
- config
- key
- thingy
- public static boolean hasThingy(String topLevelKey, String key, net.sf.json.JSONObject config)
Z= {"key0":{ "key1':X } }The call here would be
hasThingy("key0",Z,"key1');
that would return true
topLevelKey
- key
- config
- public static boolean isSaved(net.sf.json.JSONObject config)
config
- public static void setSaved(net.sf.json.JSONObject config, boolean value)
public static net.sf.json.JSONArray getComment(net.sf.json.JSONObject config)
config
- public static void setComment(net.sf.json.JSONObject config, net.sf.json.JSONArray comment)
public static void setComment(net.sf.json.JSONObject config, String comment)
public static void setExtraAttributes(net.sf.json.JSONObject config, net.sf.json.JSONObject attributes)
public static net.sf.json.JSONObject getExtraAttributes(net.sf.json.JSONObject config)
Copyright © 2019. All Rights Reserved.