helma.scripting.rhino
Class PathWrapper

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by helma.scripting.rhino.PathWrapper
All Implemented Interfaces:
java.io.Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable

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

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
PathWrapper(RhinoCore core)
          Zero arg constructor for creating the PathWrapper prototype.
 
Method Summary
 int contains(java.lang.Object obj)
          Checks if the given object is contained in the request path
 java.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
associateValue, avoidObjectDetection, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, equivalentValues, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, 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, wait, wait, wait
 

Constructor Detail

PathWrapper

public PathWrapper(RhinoCore core)
            throws org.mozilla.javascript.PropertyException,
                   java.lang.NoSuchMethodException
Zero arg constructor for creating the PathWrapper prototype.

Throws:
org.mozilla.javascript.PropertyException
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 interface org.mozilla.javascript.Scriptable
Overrides:
get in class org.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 interface org.mozilla.javascript.Scriptable
Overrides:
get in class org.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 interface org.mozilla.javascript.Scriptable
Overrides:
has in class org.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 interface org.mozilla.javascript.Scriptable
Overrides:
has in class org.mozilla.javascript.ScriptableObject

getIds

public java.lang.Object[] getIds()
Returns a list of array indices 0..length-1.

Specified by:
getIds in interface org.mozilla.javascript.Scriptable
Overrides:
getIds in class org.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 interface org.mozilla.javascript.Scriptable
Specified by:
getClassName in class org.mozilla.javascript.ScriptableObject

toString

public java.lang.String toString()
Overrides:
toString in class java.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 interface org.mozilla.javascript.Scriptable
Overrides:
getDefaultValue in class org.mozilla.javascript.ScriptableObject
Parameters:
hint - the type hint
Returns:
the default value for the object


Copyright © 1998-1998-${year} Helma.org. All Rights Reserved.