|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.extensions.webscripts.ScriptHelper
public final class ScriptHelper
A helper class with static functions for working with Scriptable maps, arrays and ScriptModelObjects.
Constructor Summary | |
---|---|
ScriptHelper()
|
Method Summary | |
---|---|
static ScriptModelObject |
getObject(RequestContext context,
String objectTypeId,
String objectId)
Retrieves a model object from the underlying store and hands it back wrapped as a ScriptModelObject. |
static org.mozilla.javascript.Scriptable |
toScriptableArray(org.mozilla.javascript.Scriptable scope,
String[] elements)
Converts a given array to a Scriptable array that can be traversed by the script and Freemarker engines |
static ScriptableMap |
toScriptableMap(Map<String,Serializable> map)
Converts an existing map to a Scriptable map |
static ScriptableMap |
toScriptableMap(RequestContext context,
Map<String,ModelObject> objects)
Creates a Scriptable Map for a given map of model objects |
static ScriptableMap |
toScriptableMap(RequestContext context,
ModelObject[] modelObjects)
Creates a Scriptable Map for a given array of model objects |
static ScriptModelObject |
toScriptModelObject(RequestContext context,
ModelObject modelObject)
Wraps a ModelObject with a script wrapper to produce a ScriptModelObject that can be used by the script and Freemarker engines. |
static Object[] |
toScriptModelObjectArray(RequestContext context,
Map<String,ModelObject> objects)
Converts a map of model objects to an array of ScriptModelObjects which can be used by the script and Freemarker engines. |
static Object[] |
toScriptModelObjectArray(RequestContext context,
ModelObject[] modelObjects)
Converts an array of ModelObjects to an array of ScriptModelObjects which can be used by the script and Freemarker engines. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ScriptHelper()
Method Detail |
---|
public static ScriptableMap toScriptableMap(RequestContext context, ModelObject[] modelObjects)
context
- the contextmodelObjects
- the model objects
public static ScriptableMap toScriptableMap(RequestContext context, Map<String,ModelObject> objects)
context
- the contextobjects
- a map of model objects (keyed by object id)
public static ScriptableMap toScriptableMap(Map<String,Serializable> map)
map
- the map
public static org.mozilla.javascript.Scriptable toScriptableArray(org.mozilla.javascript.Scriptable scope, String[] elements)
scope
- the scopeelements
- the elements
public static ScriptModelObject toScriptModelObject(RequestContext context, ModelObject modelObject)
context
- the contextmodelObject
- the model object
public static Object[] toScriptModelObjectArray(RequestContext context, ModelObject[] modelObjects)
context
- the contextmodelObjects
- the model objects
public static Object[] toScriptModelObjectArray(RequestContext context, Map<String,ModelObject> objects)
context
- the contextobjects
- the model objects
public static ScriptModelObject getObject(RequestContext context, String objectTypeId, String objectId)
id
- the id
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |