Package helma.scripting.rhino
Class PathWrapper
java.lang.Object
org.mozilla.javascript.ScriptableObject
helma.scripting.rhino.PathWrapper
- All Implemented Interfaces:
Serializable
,org.mozilla.javascript.ConstProperties
,org.mozilla.javascript.debug.DebuggableObject
,org.mozilla.javascript.Scriptable
,org.mozilla.javascript.SymbolScriptable
public class PathWrapper
extends org.mozilla.javascript.ScriptableObject
This class wraps around instances of helma.framework.core.RequestPath and
exposes them in an array-like fashion to the JavaScript runtime.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.mozilla.javascript.ScriptableObject
org.mozilla.javascript.ScriptableObject.KeyComparator
-
Field Summary
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
ConstructorsConstructorDescriptionPathWrapper
(RhinoCore core) Zero arg constructor for creating the PathWrapper prototype. -
Method Summary
Modifier and TypeMethodDescriptionint
Checks if the given object is contained in the request pathget
(int idx, org.mozilla.javascript.Scriptable start) Returns a path object in the wrapped path by property name.Returns a path object in the wrapped path by property name.getDefaultValue
(Class hint) Return a primitive representation for this object.Object[]
getIds()
Returns a list of array indices 0..length-1.long
Getter for length property.boolean
has
(int index, org.mozilla.javascript.Scriptable start) Checks if an object with the given index is contained in the path.boolean
Checks if an object with the given name is contained in the path.Returns the wrapped path rendered as URL path.toString()
Methods inherited from class org.mozilla.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChangeForSlot, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, equivalentValues, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSuperProperty, getSuperProperty, getSuperProperty, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, hasInstance, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, put, putConst, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
-
Constructor Details
-
PathWrapper
public PathWrapper(RhinoCore core) throws org.mozilla.javascript.RhinoException, NoSuchMethodException Zero arg constructor for creating the PathWrapper prototype.- Throws:
org.mozilla.javascript.RhinoException
NoSuchMethodException
-
-
Method Details
-
get
Returns a path object in the wrapped path by property name.- Specified by:
get
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
get
in classorg.mozilla.javascript.ScriptableObject
-
get
Returns a path object in the wrapped path by property name.- Specified by:
get
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
get
in classorg.mozilla.javascript.ScriptableObject
-
has
Checks if an object with the given name is contained in the path.- Specified by:
has
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
has
in classorg.mozilla.javascript.ScriptableObject
-
has
public boolean has(int index, org.mozilla.javascript.Scriptable start) Checks if an object with the given index is contained in the path.- Specified by:
has
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
has
in classorg.mozilla.javascript.ScriptableObject
-
getIds
Returns a list of array indices 0..length-1.- Specified by:
getIds
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
getIds
in classorg.mozilla.javascript.ScriptableObject
-
getLength
public long getLength()Getter for length property. -
href
Returns the wrapped path rendered as URL path.- Throws:
UnsupportedEncodingException
-
contains
Checks if the given object is contained in the request path- Parameters:
obj
- the element to check- Returns:
- the index of the element, or -1 if it isn't contained
-
getClassName
- Specified by:
getClassName
in interfaceorg.mozilla.javascript.Scriptable
- Specified by:
getClassName
in classorg.mozilla.javascript.ScriptableObject
-
toString
-
getDefaultValue
Return a primitive representation for this object. FIXME: We always return a string representation.- Specified by:
getDefaultValue
in interfaceorg.mozilla.javascript.Scriptable
- Overrides:
getDefaultValue
in classorg.mozilla.javascript.ScriptableObject
- Parameters:
hint
- the type hint- Returns:
- the default value for the object
-