Package helma.scripting.rhino
Class PathWrapper
- java.lang.Object
-
- org.mozilla.javascript.ScriptableObject
-
- helma.scripting.rhino.PathWrapper
-
- All Implemented Interfaces:
java.io.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:
RequestPath
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PathWrapper(RhinoCore core)
Zero arg constructor for creating the PathWrapper prototype.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
contains(java.lang.Object obj)
Checks if the given object is contained in the request pathjava.lang.Object
get(int idx, org.mozilla.javascript.Scriptable start)
Returns a path object in the wrapped path by property name.java.lang.Object
get(java.lang.String name, org.mozilla.javascript.Scriptable start)
Returns a path object in the wrapped path by property name.java.lang.String
getClassName()
java.lang.Object
getDefaultValue(java.lang.Class hint)
Return a primitive representation for this object.java.lang.Object[]
getIds()
Returns a list of array indices 0..length-1.long
getLength()
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
has(java.lang.String name, org.mozilla.javascript.Scriptable start)
Checks if an object with the given name is contained in the path.java.lang.String
href(java.lang.Object action)
Returns the wrapped path rendered as URL path.java.lang.String
toString()
-
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, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGetterOrSetter, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, 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, putProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
-
-
-
-
Constructor Detail
-
PathWrapper
public PathWrapper(RhinoCore core) throws org.mozilla.javascript.RhinoException, java.lang.NoSuchMethodException
Zero arg constructor for creating the PathWrapper prototype.- Throws:
org.mozilla.javascript.RhinoException
java.lang.NoSuchMethodException
-
-
Method Detail
-
get
public java.lang.Object get(java.lang.String name, org.mozilla.javascript.Scriptable start)
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
public java.lang.Object get(int idx, org.mozilla.javascript.Scriptable start)
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
public boolean has(java.lang.String name, org.mozilla.javascript.Scriptable start)
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
public java.lang.Object[] 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
public java.lang.String href(java.lang.Object action) throws java.io.UnsupportedEncodingException
Returns the wrapped path rendered as URL path.- Throws:
java.io.UnsupportedEncodingException
-
contains
public int contains(java.lang.Object obj)
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
public java.lang.String getClassName()
- Specified by:
getClassName
in interfaceorg.mozilla.javascript.Scriptable
- Specified by:
getClassName
in classorg.mozilla.javascript.ScriptableObject
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getDefaultValue
public java.lang.Object getDefaultValue(java.lang.Class hint)
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
-
-