Class ScriptValueConverter


  • public final class ScriptValueConverter
    extends java.lang.Object
    Value Converter to marshal objects between Java and Javascript.
    Author:
    Kevin Roast
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object unwrapValue​(java.lang.Object value)
      Convert an object from a script wrapper value to a serializable value valid outside of the Rhino script processor context.
      static java.lang.Object wrapValue​(org.mozilla.javascript.Scriptable scope, java.lang.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 java.lang.Object unwrapValue​(java.lang.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 java.lang.Object wrapValue​(org.mozilla.javascript.Scriptable scope,
                                                 java.lang.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:
        scope - Scripting scope
        value - Property value
        Returns:
        Value safe for scripting usage