org.apache.sling.scripting.javascript.wrapper
Class ScriptableBase

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by org.apache.sling.scripting.javascript.wrapper.ScriptableBase
All Implemented Interfaces:
Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable
Direct Known Subclasses:
ScriptableCalendar, ScriptableNode, ScriptableProperty

public abstract class ScriptableBase
extends org.mozilla.javascript.ScriptableObject

Base class for Scriptable objects, uses the NativeJavaObject wrapper to provide default wrapping of methods and properties (SLING-397)

See Also:
Serialized Form

Field Summary
static String JSFUNC_PREFIX
           
 
Fields inherited from class org.mozilla.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
ScriptableBase()
           
 
Method Summary
protected  Object getNative(String name, org.mozilla.javascript.Scriptable start)
           
protected abstract  Class<?> getStaticType()
           
protected abstract  Object getWrappedObject()
           
abstract  Class<?> jsGet_javascriptWrapperClass()
          Used in testing, to check that the right wrapper is used.
 
Methods inherited from class org.mozilla.javascript.ScriptableObject
associateValue, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, equivalentValues, get, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassName, getClassPrototype, getDefaultValue, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JSFUNC_PREFIX

public static final String JSFUNC_PREFIX
See Also:
Constant Field Values
Constructor Detail

ScriptableBase

public ScriptableBase()
Method Detail

getNative

protected Object getNative(String name,
                           org.mozilla.javascript.Scriptable start)

getWrappedObject

protected abstract Object getWrappedObject()
Returns:
the Java object that we're wrapping, used to create a NativeJavaObject instance for default wrapping.

getStaticType

protected abstract Class<?> getStaticType()
Returns:
the static type to use for NativeJavaObject wrapping

jsGet_javascriptWrapperClass

public abstract Class<?> jsGet_javascriptWrapperClass()
Used in testing, to check that the right wrapper is used. For some reason, defining the method here didn't work, it had to be defined in all descendant classes.



Copyright © 2007-2011 The Apache Software Foundation. All Rights Reserved.