public class ScriptableResource extends org.mozilla.javascript.ScriptableObject implements SlingWrapper
Modifier and Type | Field and Description |
---|---|
static String |
CLASSNAME |
Constructor and Description |
---|
ScriptableResource() |
ScriptableResource(Resource resource) |
Modifier and Type | Method and Description |
---|---|
String |
getClassName()
The name of the JavaScript host object "class".
|
Object |
getDefaultValue(Class typeHint) |
Class<?>[] |
getWrappedClasses()
The list of Java classes wrapped by this wrapper.
|
void |
jsConstructor(Object res) |
static Object |
jsFunction_adaptTo(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable thisObj,
Object[] args,
org.mozilla.javascript.Function funObj)
Implements the adaptTo() method for JavaScript scripts.
|
Object |
jsFunction_getChild(String childPath)
Maps getChild(String childPath) to getChild method.
|
org.mozilla.javascript.NativeArray |
jsFunction_getChildren() |
Object |
jsFunction_getMetadata()
Deprecated.
since 2.1.0 because the method is named incorrectly.
|
String |
jsFunction_getName() |
Object |
jsFunction_getObject() |
Object |
jsFunction_getParent() |
String |
jsFunction_getPath() |
Object |
jsFunction_getResourceMetadata() |
Object |
jsFunction_getResourceResolver() |
String |
jsFunction_getResourceSuperType() |
String |
jsFunction_getResourceType() |
boolean |
jsFunction_isResourceType(String type) |
org.mozilla.javascript.NativeArray |
jsFunction_listChildren() |
Object |
jsGet_meta()
Deprecated.
since 2.1.0 because it maps the method name incorrectly.
|
String |
jsGet_name() |
Object |
jsGet_parent() |
String |
jsGet_path() |
Object |
jsGet_properties() |
Object |
jsGet_resourceMetadata() |
Object |
jsGet_resourceResolver() |
String |
jsGet_resourceSuperType() |
String |
jsGet_resourceType() |
String |
jsGet_type()
Deprecated.
since 2.1.0 because it maps the method name incorrectly.
|
void |
setResource(Resource entry) |
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 String CLASSNAME
public ScriptableResource()
public ScriptableResource(Resource resource)
public void jsConstructor(Object res)
public String jsGet_name()
public String jsFunction_getName()
public String jsGet_path()
public String jsFunction_getPath()
@Deprecated public String jsGet_type()
public String jsGet_resourceType()
public String jsFunction_getResourceType()
public org.mozilla.javascript.NativeArray jsFunction_listChildren()
public org.mozilla.javascript.NativeArray jsFunction_getChildren()
public Object jsGet_parent()
public Object jsFunction_getParent()
public String jsGet_resourceSuperType()
public String jsFunction_getResourceSuperType()
public boolean jsFunction_isResourceType(String type)
@Deprecated public Object jsGet_meta()
public Object jsGet_resourceMetadata()
@Deprecated public Object jsFunction_getMetadata()
public Object jsFunction_getResourceMetadata()
public Object jsFunction_getResourceResolver()
public Object jsGet_resourceResolver()
public Object jsFunction_getChild(String childPath)
childPath
- the child pathchildPath
or null
public Object jsFunction_getObject()
public static Object jsFunction_adaptTo(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, 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 Object jsGet_properties()
public String getClassName()
SlingWrapper
getClassName
in interface SlingWrapper
getClassName
in interface org.mozilla.javascript.Scriptable
getClassName
in class org.mozilla.javascript.ScriptableObject
public Object getDefaultValue(Class typeHint)
getDefaultValue
in interface org.mozilla.javascript.Scriptable
getDefaultValue
in class org.mozilla.javascript.ScriptableObject
public void setResource(Resource entry)
public Class<?>[] getWrappedClasses()
SlingWrapper
getWrappedClasses
in interface SlingWrapper
public Object unwrap()
unwrap
in interface org.mozilla.javascript.Wrapper
Copyright © 2017 The Apache Software Foundation. All rights reserved.