org.mozilla.javascript
Class NativeString

java.lang.Object
  |
  +--org.mozilla.javascript.ScriptableObject
        |
        +--org.mozilla.javascript.IdScriptable
              |
              +--org.mozilla.javascript.NativeString
All Implemented Interfaces:
IdFunctionMaster, Scriptable, java.io.Serializable

public class NativeString
extends IdScriptable

This class implements the String native object. See ECMA 15.5. String methods for dealing with regular expressions are ported directly from C. Latest port is from version 1.40.12.19 in the JSFUN13_BRANCH.

Author:
Mike McCabe, Norris Boyd
See Also:
Serialized Form

Fields inherited from class org.mozilla.javascript.ScriptableObject
DONTENUM, EMPTY, PERMANENT, READONLY
 
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
NativeString()
          Zero-parameter constructor: just used to create String.prototype
NativeString(java.lang.String s)
           
 
Method Summary
 java.lang.Object execMethod(int methodId, IdFunction f, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
          'thisObj' will be null if invoked as constructor, in which case instance of Scriptable should be returned.
 java.lang.Object get(int index, Scriptable start)
          Returns the value of the indexed property or NOT_FOUND.
 java.lang.String getClassName()
          Return the name of the class.
static void init(Context cx, Scriptable scope, boolean sealed)
           
 double jsGet_length()
           
 int methodArity(int methodId)
          Get arity or defined argument count for method with given id.
 void put(int index, Scriptable start, java.lang.Object value)
          Sets the value of the indexed property, creating it if need be.
 java.lang.String toString()
           
 
Methods inherited from class org.mozilla.javascript.IdScriptable
addAsPrototype, defineProperty, delete, get, getAttributes, has, put, setAttributes
 
Methods inherited from class org.mozilla.javascript.ScriptableObject
callMethod, defineClass, defineClass, defineFunctionProperties, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, getAllIds, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, has, hasInstance, hasProperty, hasProperty, isSealed, putProperty, putProperty, sealObject, setAttributes, setParentScope, setPrototype
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NativeString

public NativeString()
Zero-parameter constructor: just used to create String.prototype

NativeString

public NativeString(java.lang.String s)
Method Detail

init

public static void init(Context cx,
                        Scriptable scope,
                        boolean sealed)

getClassName

public java.lang.String getClassName()
Description copied from class: ScriptableObject
Return the name of the class. This is typically the same name as the constructor. Classes extending ScriptableObject must implement this abstract method.
Overrides:
getClassName in class ScriptableObject

methodArity

public int methodArity(int methodId)
Description copied from class: IdScriptable
Get arity or defined argument count for method with given id. Should return -1 if methodId is not known or can not be used with execMethod call.
Overrides:
methodArity in class IdScriptable

execMethod

public java.lang.Object execMethod(int methodId,
                                   IdFunction f,
                                   Context cx,
                                   Scriptable scope,
                                   Scriptable thisObj,
                                   java.lang.Object[] args)
                            throws JavaScriptException
Description copied from class: IdScriptable
'thisObj' will be null if invoked as constructor, in which case instance of Scriptable should be returned.
Overrides:
execMethod in class IdScriptable

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

get

public java.lang.Object get(int index,
                            Scriptable start)
Description copied from class: ScriptableObject
Returns the value of the indexed property or NOT_FOUND.
Overrides:
get in class ScriptableObject
Following copied from class: org.mozilla.javascript.ScriptableObject
Parameters:
index - the numeric index for the property
start - the object in which the lookup began
Returns:
the value of the property (may be null), or NOT_FOUND

put

public void put(int index,
                Scriptable start,
                java.lang.Object value)
Description copied from class: ScriptableObject
Sets the value of the indexed property, creating it if need be.
Overrides:
put in class ScriptableObject
Following copied from class: org.mozilla.javascript.ScriptableObject
Parameters:
index - the numeric index for the property
start - the object whose property is being set
value - value to set the property to

jsGet_length

public double jsGet_length()