public class ScriptableResource extends org.mozilla.javascript.ScriptableObject implements SlingWrapper
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASSNAME |
Constructor and Description |
---|
ScriptableResource() |
ScriptableResource(Resource resource) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getClassName()
The name of the JavaScript host object "class".
|
java.lang.Object |
getDefaultValue(java.lang.Class typeHint) |
java.lang.Class<?>[] |
getWrappedClasses()
The list of Java classes wrapped by this wrapper.
|
void |
jsConstructor(java.lang.Object res) |
static java.lang.Object |
jsFunction_adaptTo(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable thisObj,
java.lang.Object[] args,
org.mozilla.javascript.Function funObj)
Implements the adaptTo() method for JavaScript scripts.
|
java.lang.Object |
jsFunction_getChild(java.lang.String childPath)
Maps getChild(String childPath) to getChild method.
|
org.mozilla.javascript.NativeArray |
jsFunction_getChildren() |
java.lang.Object |
jsFunction_getMetadata()
Deprecated.
since 2.1.0 because the method is named incorrectly.
|
java.lang.String |
jsFunction_getName() |
java.lang.Object |
jsFunction_getObject() |
java.lang.Object |
jsFunction_getParent() |
java.lang.String |
jsFunction_getPath() |
java.lang.Object |
jsFunction_getResourceMetadata() |
java.lang.Object |
jsFunction_getResourceResolver() |
java.lang.String |
jsFunction_getResourceSuperType() |
java.lang.String |
jsFunction_getResourceType() |
boolean |
jsFunction_isResourceType(java.lang.String type) |
org.mozilla.javascript.NativeArray |
jsFunction_listChildren() |
java.lang.Object |
jsGet_meta()
Deprecated.
since 2.1.0 because it maps the method name incorrectly.
|
java.lang.String |
jsGet_name() |
java.lang.Object |
jsGet_parent() |
java.lang.String |
jsGet_path() |
java.lang.Object |
jsGet_properties() |
java.lang.Object |
jsGet_resourceMetadata() |
java.lang.Object |
jsGet_resourceResolver() |
java.lang.String |
jsGet_resourceSuperType() |
java.lang.String |
jsGet_resourceType() |
java.lang.String |
jsGet_type()
Deprecated.
since 2.1.0 because it maps the method name incorrectly.
|
void |
setResource(Resource entry) |
java.lang.Object |
unwrap() |
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, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, 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
public static final java.lang.String CLASSNAME
public ScriptableResource()
public ScriptableResource(Resource resource)
public void jsConstructor(java.lang.Object res)
public java.lang.String jsGet_name()
public java.lang.String jsFunction_getName()
public java.lang.String jsGet_path()
public java.lang.String jsFunction_getPath()
@Deprecated public java.lang.String jsGet_type()
public java.lang.String jsGet_resourceType()
public java.lang.String jsFunction_getResourceType()
public org.mozilla.javascript.NativeArray jsFunction_listChildren()
public org.mozilla.javascript.NativeArray jsFunction_getChildren()
public java.lang.Object jsGet_parent()
public java.lang.Object jsFunction_getParent()
public java.lang.String jsGet_resourceSuperType()
public java.lang.String jsFunction_getResourceSuperType()
public boolean jsFunction_isResourceType(java.lang.String type)
@Deprecated public java.lang.Object jsGet_meta()
public java.lang.Object jsGet_resourceMetadata()
@Deprecated public java.lang.Object jsFunction_getMetadata()
public java.lang.Object jsFunction_getResourceMetadata()
public java.lang.Object jsFunction_getResourceResolver()
public java.lang.Object jsGet_resourceResolver()
public java.lang.Object jsFunction_getChild(java.lang.String childPath)
childPath
- the child pathchildPath
or null
public java.lang.Object jsFunction_getObject()
public static java.lang.Object jsFunction_adaptTo(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] args, org.mozilla.javascript.Function funObj)
Supporting String as an argument to this method allows for much easier use in JavaScript since instead of for example writing "javax.jcr.Node" instead of the much clumsier Packages.javax.jcr.Node.
cx
- The current Rhino contextthisObj
- The ScriptableResource object in which the method is
called.args
- The argument vector. Only the first argument is used which is
expected to be a Class object or a String. If no argument is
supplied or it has the wrong type, this method just returns
null
.funObj
- The object representing the JavaScript adaptTo function.null
if
the resource does not adapt to the required type or if the
argument is of the wrong type or missing.public java.lang.Object jsGet_properties()
public java.lang.String getClassName()
SlingWrapper
getClassName
in interface SlingWrapper
getClassName
in interface org.mozilla.javascript.Scriptable
getClassName
in class org.mozilla.javascript.ScriptableObject
public java.lang.Object getDefaultValue(java.lang.Class typeHint)
getDefaultValue
in interface org.mozilla.javascript.Scriptable
getDefaultValue
in class org.mozilla.javascript.ScriptableObject
public void setResource(Resource entry)
public java.lang.Class<?>[] getWrappedClasses()
SlingWrapper
getWrappedClasses
in interface SlingWrapper
public java.lang.Object unwrap()
unwrap
in interface org.mozilla.javascript.Wrapper
Copyright © 2018 The Apache Software Foundation. All rights reserved.