|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mozilla.javascript.ScriptableObject org.apache.sling.scripting.javascript.wrapper.ScriptableResource
public class ScriptableResource
Resource in JavaScript has following signature: [Object] getData(); [Object] data [Item] getItem(); [Item] item [String] getResourceType(); [String] type [String] getPath(); [String] path
Field Summary | |
---|---|
static String |
CLASSNAME
|
static Class<?>[] |
WRAPPED_CLASSES
|
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 | |
---|---|
ScriptableResource()
|
|
ScriptableResource(Resource resource)
|
Method Summary | |
---|---|
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_getMetadata()
Deprecated. since 2.1.0 because the method is named incorrectly. |
Object |
jsFunction_getObject()
Helper method to easily retrieve the default adapted object of the resource. |
String |
jsFunction_getPath()
Mapps getPath() method as getPath() method. |
Object |
jsFunction_getResourceMetadata()
Maps getResourceMetadata() to getResourceMetadata method. |
Object |
jsFunction_getResourceResolver()
Maps getResourceResolver() to resourceResolver property. |
String |
jsFunction_getResourceSuperType()
Maps getResourceSuperType() to the getResourceSuperType() method. |
String |
jsFunction_getResourceType()
Maps getResourceType() to the getResourceType() method. |
Object |
jsGet_meta()
Deprecated. since 2.1.0 because it maps the method name incorrectly. |
String |
jsGet_path()
Mapps getPath() method as path property. |
Object |
jsGet_resourceMetadata()
Maps getResourceMetadata() to resourceMetadata property. |
Object |
jsGet_resourceResolver()
Maps getResourceResolver() to getResourceResolver method. |
String |
jsGet_resourceSuperType()
Maps getResourceSuperType() to resourceSuperType property. |
String |
jsGet_resourceType()
Maps getResourceType() to resourceType property. |
String |
jsGet_type()
Deprecated. since 2.1.0 because it maps the method name incorrectly. |
void |
setResource(Resource entry)
|
Object |
unwrap()
|
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, getClassPrototype, 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 |
---|
public static final String CLASSNAME
public static final Class<?>[] WRAPPED_CLASSES
Constructor Detail |
---|
public ScriptableResource()
public ScriptableResource(Resource resource)
Method Detail |
---|
public void jsConstructor(Object res)
public String jsGet_path()
public String jsFunction_getPath()
@Deprecated public String jsGet_type()
public String jsGet_resourceType()
public String jsFunction_getResourceType()
public String jsGet_resourceSuperType()
public String jsFunction_getResourceSuperType()
@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_getObject()
Calling this method is equivalent to calling the adaptTo method with the argument "java.lang.Object".
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 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |