org.springframework.extensions.webscripts
Class ScriptValueConverter

java.lang.Object
  extended by org.springframework.extensions.webscripts.ScriptValueConverter

public final class ScriptValueConverter
extends Object

Value Converter to marshal objects between Java and Javascript.

Author:
Kevin Roast

Method Summary
static Object unwrapValue(Object value)
          Convert an object from a script wrapper value to a serializable value valid outside of the Rhino script processor context.
static Object wrapValue(org.mozilla.javascript.Scriptable scope, Object value)
          Convert an object from any repository serialized value to a valid script object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

unwrapValue

public static Object unwrapValue(Object value)
Convert an object from a script wrapper value to a serializable value valid outside of the Rhino script processor context. This includes converting JavaScript Array objects to Lists of valid objects.

Parameters:
value - Value to convert from script wrapper object to external object value.
Returns:
unwrapped and converted value.

wrapValue

public static Object wrapValue(org.mozilla.javascript.Scriptable scope,
                               Object value)
Convert an object from any repository serialized value to a valid script object. This includes converting Collection multi-value properties into JavaScript Array objects.

Parameters:
services - Repository Services Registry
scope - Scripting scope
qname - QName of the property value for conversion
value - Property value
Returns:
Value safe for scripting usage


Copyright © 2009 SpringSource, Inc. All Rights Reserved.