Package org.apache.sling.scripting.javascript.wrapper

## Class ScriptableNode

- java.lang.Object
- - org.mozilla.javascript.ScriptableObject
  - - org.apache.sling.scripting.javascript.wrapper.ScriptableBase
    - - org.apache.sling.scripting.javascript.wrapper.ScriptableNode

All Implemented Interfaces:
  `Serializable`, `SlingWrapper`, `org.mozilla.javascript.ConstProperties`, `org.mozilla.javascript.debug.DebuggableObject`, `org.mozilla.javascript.Scriptable`, `org.mozilla.javascript.Wrapper`

Direct Known Subclasses:
  `ScriptableVersion`, `ScriptableVersionHistory`

    public class ScriptableNode
    extends ScriptableBase
    implements SlingWrapper

A wrapper for JCR nodes that exposes all properties and child nodes as properties of a Javascript object.

See Also:
  Serialized Form

### Field Summary

Fields
`static String` `CLASSNAME`

### Fields inherited from class org.apache.sling.scripting.javascript.wrapper.ScriptableBase

`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

Constructors
`ScriptableNode()`

### Method Summary

All Methods Instance Methods Concrete Methods
`Object` `get​(String name, org.mozilla.javascript.Scriptable start)` Gets the value of a (Javascript) property or child node.
`String` `getClassName()` The name of the JavaScript host object "class".
`Object` `getDefaultValue​(Class typeHint)`
`Object[]` `getIds()`
`protected Class<?>` `getStaticType()`
`Class<?>[]` `getWrappedClasses()` The list of Java classes wrapped by this wrapper.
`protected Object` `getWrappedObject()`
`boolean` `has​(String name, org.mozilla.javascript.Scriptable start)`
`void` `jsConstructor​(Object res)`
`Object` `jsFunction_addNode​(String path, String primaryType)`
`Object` `jsFunction_getBaseVersion()`
`boolean` `jsFunction_getCheckedOut()`
`Object` `jsFunction_getChildren()`
`Object` `jsFunction_getDefinition()`
`int` `jsFunction_getDepth()`
`int` `jsFunction_getIndex()`
`Object` `jsFunction_getLock()`
`boolean` `jsFunction_getLocked()`
`javax.jcr.nodetype.NodeType[]` `jsFunction_getMixinNodeTypes()`
`boolean` `jsFunction_getModified()`
`String` `jsFunction_getName()`
`boolean` `jsFunction_getNew()`
`Object` `jsFunction_getNode​(String path)`
`Object` `jsFunction_getNodes​(String namePattern)`
`Object` `jsFunction_getParent()`
`String` `jsFunction_getPath()`
`Object` `jsFunction_getPrimaryItem()`
`Object` `jsFunction_getPrimaryNodeType()`
`Object` `jsFunction_getProperties()`
`Object` `jsFunction_getProperty​(String name)`
`Iterator<?>` `jsFunction_getReferences()`
`Object` `jsFunction_getSession()`
`String` `jsFunction_getUUID()`
`Object` `jsFunction_getVersionHistory()`
`boolean` `jsFunction_hasNode​(String path)`
`void` `jsFunction_remove()`
`String` `toString()`
`Object` `unwrap()`

### Methods inherited from class org.apache.sling.scripting.javascript.wrapper.ScriptableBase

`getNative`

### Methods inherited from class org.mozilla.javascript.ScriptableObject

`applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, equivalentValues, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGetterOrSetter, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, hasInstance, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### CLASSNAME

    public static final String CLASSNAME

See Also:
  Constant Field Values

### Constructor Detail

#### ScriptableNode

    public ScriptableNode()

### Method Detail

#### jsConstructor

    public void jsConstructor​(Object res)

#### getClassName

    public String getClassName()

Description copied from interface: `SlingWrapper`
The name of the JavaScript host object "class".

Specified by:
  `getClassName` in interface `org.mozilla.javascript.Scriptable`
Specified by:
  `getClassName` in interface `SlingWrapper`
Specified by:
  `getClassName` in class `org.mozilla.javascript.ScriptableObject`
Returns:
  the class name

#### getWrappedClasses

    public Class<?>[] getWrappedClasses()

Description copied from interface: `SlingWrapper`
The list of Java classes wrapped by this wrapper.

Specified by:
  `getWrappedClasses` in interface `SlingWrapper`
Returns:
  the wrapped classes

#### getStaticType

    protected Class<?> getStaticType()

Specified by:
  `getStaticType` in class `ScriptableBase`
Returns:
  the static type to use for NativeJavaObject wrapping

#### getWrappedObject

    protected Object getWrappedObject()

Specified by:
  `getWrappedObject` in class `ScriptableBase`
Returns:
  the Java object that we're wrapping, used to create a NativeJavaObject instance for default wrapping.

#### jsFunction_addNode

    public Object jsFunction_addNode​(String path,
                                     String primaryType)
                              throws javax.jcr.RepositoryException

Throws:
  `javax.jcr.RepositoryException`

#### jsFunction_getNode

    public Object jsFunction_getNode​(String path)
                              throws javax.jcr.RepositoryException

Throws:
  `javax.jcr.RepositoryException`

#### jsFunction_getChildren

    public Object jsFunction_getChildren()

#### jsFunction_getNodes

    public Object jsFunction_getNodes​(String namePattern)

#### jsFunction_getProperties

    public Object jsFunction_getProperties()

#### jsFunction_getPrimaryItem

    public Object jsFunction_getPrimaryItem()

#### jsFunction_getProperty

    public Object jsFunction_getProperty​(String name)
                                  throws javax.jcr.RepositoryException

Throws:
  `javax.jcr.RepositoryException`

#### jsFunction_getUUID

    public String jsFunction_getUUID()

#### jsFunction_getIndex

    public int jsFunction_getIndex()

#### jsFunction_getReferences

    public Iterator<?> jsFunction_getReferences()

#### jsFunction_getPrimaryNodeType

    public Object jsFunction_getPrimaryNodeType()

#### jsFunction_getMixinNodeTypes

    public javax.jcr.nodetype.NodeType[] jsFunction_getMixinNodeTypes()

#### jsFunction_getDefinition

    public Object jsFunction_getDefinition()

#### jsFunction_getCheckedOut

    public boolean jsFunction_getCheckedOut()

#### jsFunction_getVersionHistory

    public Object jsFunction_getVersionHistory()

#### jsFunction_getBaseVersion

    public Object jsFunction_getBaseVersion()

#### jsFunction_getLock

    public Object jsFunction_getLock()

#### jsFunction_getLocked

    public boolean jsFunction_getLocked()

#### jsFunction_getSession

    public Object jsFunction_getSession()

#### jsFunction_getPath

    public String jsFunction_getPath()

#### jsFunction_getName

    public String jsFunction_getName()

#### jsFunction_getParent

    public Object jsFunction_getParent()

#### jsFunction_getDepth

    public int jsFunction_getDepth()

#### jsFunction_getNew

    public boolean jsFunction_getNew()

#### jsFunction_getModified

    public boolean jsFunction_getModified()

#### jsFunction_remove

    public void jsFunction_remove()
                           throws javax.jcr.RepositoryException

Throws:
  `javax.jcr.RepositoryException`

#### jsFunction_hasNode

    public boolean jsFunction_hasNode​(String path)
                               throws javax.jcr.RepositoryException

Throws:
  `javax.jcr.RepositoryException`

#### get

    public Object get​(String name,
                      org.mozilla.javascript.Scriptable start)

Gets the value of a (Javascript) property or child node. If there is a single single-value JCR property of this node, return its string value. If there are multiple properties of the same name or child nodes of the same name, return an array.

Specified by:
  `get` in interface `org.mozilla.javascript.Scriptable`
Overrides:
  `get` in class `org.mozilla.javascript.ScriptableObject`

#### getIds

    public Object[] getIds()

Specified by:
  `getIds` in interface `org.mozilla.javascript.Scriptable`
Overrides:
  `getIds` in class `org.mozilla.javascript.ScriptableObject`

#### getDefaultValue

    public Object getDefaultValue​(Class typeHint)

Specified by:
  `getDefaultValue` in interface `org.mozilla.javascript.Scriptable`
Overrides:
  `getDefaultValue` in class `org.mozilla.javascript.ScriptableObject`

#### has

    public boolean has​(String name,
                       org.mozilla.javascript.Scriptable start)

Specified by:
  `has` in interface `org.mozilla.javascript.Scriptable`
Overrides:
  `has` in class `org.mozilla.javascript.ScriptableObject`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### unwrap

    public Object unwrap()

Specified by:
  `unwrap` in interface `org.mozilla.javascript.Wrapper`