Package org.mozilla.javascript
Class NativeString
java.lang.Object
org.mozilla.javascript.ScriptableObject
org.mozilla.javascript.IdScriptableObject
org.mozilla.javascript.NativeString
- All Implemented Interfaces:
Serializable
,ConstProperties
,DebuggableObject
,IdFunctionCall
,Scriptable
,SymbolScriptable
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.mozilla.javascript.ScriptableObject
ScriptableObject.KeyComparator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final long
private CharSequence
private static final Object
private static final int
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ScriptableObject
execIdCall
(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) 'thisObj' will be null if invoked as constructor, in which case * instance of Scriptable should be returned.protected void
protected int
Map name to id of instance property.protected int
protected int
get
(int index, Scriptable start) Returns the value of the indexed property or NOT_FOUND.int
getAttributes
(int index) Get the attributes of an indexed property.Return the name of the class.protected Object[]
getIds
(boolean nonEnumerable, boolean getSymbols) protected String
getInstanceIdName
(int id) Map id back to property name it defines.protected Object
getInstanceIdValue
(int id) Get id value.(package private) int
protected int
Get maximum id findInstanceIdInfo can generate.protected ScriptableObject
getOwnPropertyDescriptor
(Context cx, Object id) boolean
has
(int index, Scriptable start) Returns true if the property index is defined.(package private) static void
init
(Scriptable scope, boolean sealed) protected void
initPrototypeId
(int id) private static String
private static int
js_indexOf
(int methodId, String target, Object[] args) private static int
js_lastIndexOf
(String target, Object[] args) private static String
js_pad
(Context cx, Scriptable thisObj, IdFunctionObject f, Object[] args, boolean atStart) private static CharSequence
js_raw
(Context cx, Scriptable scope, Object[] args) String.raw (template, ...substitutions)private static String
js_repeat
(Context cx, Scriptable thisObj, IdFunctionObject f, Object[] args) private static CharSequence
js_slice
(CharSequence target, Object[] args) private static CharSequence
js_substr
(CharSequence target, Object[] args) private static CharSequence
js_substring
(Context cx, CharSequence target, Object[] args) void
put
(int index, Scriptable start, Object value) Sets the value of the indexed property, creating it if need be.private static NativeString
realThis
(Scriptable thisObj, IdFunctionObject f) private static String
tagify
(Context cx, Scriptable thisObj, IdFunctionObject f, String tag, String attribute, Object[] args) toString()
Methods inherited from class org.mozilla.javascript.IdScriptableObject
activatePrototypeMap, addIdFunctionProperty, defaultGet, defaultHas, defaultPut, defineOwnProperty, delete, delete, ensureType, exportAsJSClass, findInstanceIdInfo, get, get, getAttributes, getAttributes, has, has, hasPrototypeMap, initPrototypeConstructor, initPrototypeMethod, initPrototypeMethod, initPrototypeMethod, initPrototypeValue, initPrototypeValue, instanceIdInfo, put, put, setAttributes, setInstanceIdAttributes, setInstanceIdValue
Methods inherited from class org.mozilla.javascript.ScriptableObject
addLazilyInitializedValue, applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildClassCtor, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, checkValidAttributes, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, hasInstance, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
STRING_TAG
-
Id_length
private static final int Id_length- See Also:
-
MAX_INSTANCE_ID
private static final int MAX_INSTANCE_ID- See Also:
-
ConstructorId_fromCharCode
private static final int ConstructorId_fromCharCode- See Also:
-
ConstructorId_fromCodePoint
private static final int ConstructorId_fromCodePoint- See Also:
-
ConstructorId_raw
private static final int ConstructorId_raw- See Also:
-
Id_constructor
private static final int Id_constructor- See Also:
-
Id_toString
private static final int Id_toString- See Also:
-
Id_toSource
private static final int Id_toSource- See Also:
-
Id_valueOf
private static final int Id_valueOf- See Also:
-
Id_charAt
private static final int Id_charAt- See Also:
-
Id_charCodeAt
private static final int Id_charCodeAt- See Also:
-
Id_indexOf
private static final int Id_indexOf- See Also:
-
Id_lastIndexOf
private static final int Id_lastIndexOf- See Also:
-
Id_split
private static final int Id_split- See Also:
-
Id_substring
private static final int Id_substring- See Also:
-
Id_toLowerCase
private static final int Id_toLowerCase- See Also:
-
Id_toUpperCase
private static final int Id_toUpperCase- See Also:
-
Id_substr
private static final int Id_substr- See Also:
-
Id_concat
private static final int Id_concat- See Also:
-
Id_slice
private static final int Id_slice- See Also:
-
Id_bold
private static final int Id_bold- See Also:
-
Id_italics
private static final int Id_italics- See Also:
-
Id_fixed
private static final int Id_fixed- See Also:
-
Id_strike
private static final int Id_strike- See Also:
-
Id_small
private static final int Id_small- See Also:
-
Id_big
private static final int Id_big- See Also:
-
Id_blink
private static final int Id_blink- See Also:
-
Id_sup
private static final int Id_sup- See Also:
-
Id_sub
private static final int Id_sub- See Also:
-
Id_fontsize
private static final int Id_fontsize- See Also:
-
Id_fontcolor
private static final int Id_fontcolor- See Also:
-
Id_link
private static final int Id_link- See Also:
-
Id_anchor
private static final int Id_anchor- See Also:
-
Id_equals
private static final int Id_equals- See Also:
-
Id_equalsIgnoreCase
private static final int Id_equalsIgnoreCase- See Also:
-
Id_match
private static final int Id_match- See Also:
-
Id_search
private static final int Id_search- See Also:
-
Id_replace
private static final int Id_replace- See Also:
-
Id_localeCompare
private static final int Id_localeCompare- See Also:
-
Id_toLocaleLowerCase
private static final int Id_toLocaleLowerCase- See Also:
-
Id_toLocaleUpperCase
private static final int Id_toLocaleUpperCase- See Also:
-
Id_trim
private static final int Id_trim- See Also:
-
Id_trimLeft
private static final int Id_trimLeft- See Also:
-
Id_trimRight
private static final int Id_trimRight- See Also:
-
Id_includes
private static final int Id_includes- See Also:
-
Id_startsWith
private static final int Id_startsWith- See Also:
-
Id_endsWith
private static final int Id_endsWith- See Also:
-
Id_normalize
private static final int Id_normalize- See Also:
-
Id_repeat
private static final int Id_repeat- See Also:
-
Id_codePointAt
private static final int Id_codePointAt- See Also:
-
Id_padStart
private static final int Id_padStart- See Also:
-
Id_padEnd
private static final int Id_padEnd- See Also:
-
SymbolId_iterator
private static final int SymbolId_iterator- See Also:
-
Id_trimStart
private static final int Id_trimStart- See Also:
-
Id_trimEnd
private static final int Id_trimEnd- See Also:
-
MAX_PROTOTYPE_ID
private static final int MAX_PROTOTYPE_ID- See Also:
-
ConstructorId_charAt
private static final int ConstructorId_charAt- See Also:
-
ConstructorId_charCodeAt
private static final int ConstructorId_charCodeAt- See Also:
-
ConstructorId_indexOf
private static final int ConstructorId_indexOf- See Also:
-
ConstructorId_lastIndexOf
private static final int ConstructorId_lastIndexOf- See Also:
-
ConstructorId_split
private static final int ConstructorId_split- See Also:
-
ConstructorId_substring
private static final int ConstructorId_substring- See Also:
-
ConstructorId_toLowerCase
private static final int ConstructorId_toLowerCase- See Also:
-
ConstructorId_toUpperCase
private static final int ConstructorId_toUpperCase- See Also:
-
ConstructorId_substr
private static final int ConstructorId_substr- See Also:
-
ConstructorId_concat
private static final int ConstructorId_concat- See Also:
-
ConstructorId_slice
private static final int ConstructorId_slice- See Also:
-
ConstructorId_equalsIgnoreCase
private static final int ConstructorId_equalsIgnoreCase- See Also:
-
ConstructorId_match
private static final int ConstructorId_match- See Also:
-
ConstructorId_search
private static final int ConstructorId_search- See Also:
-
ConstructorId_replace
private static final int ConstructorId_replace- See Also:
-
ConstructorId_localeCompare
private static final int ConstructorId_localeCompare- See Also:
-
ConstructorId_toLocaleLowerCase
private static final int ConstructorId_toLocaleLowerCase- See Also:
-
string
-
-
Constructor Details
-
NativeString
NativeString(CharSequence s)
-
-
Method Details
-
init
-
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.
- Specified by:
getClassName
in interfaceScriptable
- Specified by:
getClassName
in classScriptableObject
-
getMaxInstanceId
protected int getMaxInstanceId()Description copied from class:IdScriptableObject
Get maximum id findInstanceIdInfo can generate.- Overrides:
getMaxInstanceId
in classIdScriptableObject
-
findInstanceIdInfo
Description copied from class:IdScriptableObject
Map name to id of instance property. Should return 0 if not found or the result ofIdScriptableObject.instanceIdInfo(int, int)
.- Overrides:
findInstanceIdInfo
in classIdScriptableObject
-
getInstanceIdName
Description copied from class:IdScriptableObject
Map id back to property name it defines.- Overrides:
getInstanceIdName
in classIdScriptableObject
-
getInstanceIdValue
Description copied from class:IdScriptableObject
Get id value. * If id value is constant, descendant can call cacheIdValue to store * value in the permanent cache. * Default implementation creates IdFunctionObject instance for given id * and cache its value- Overrides:
getInstanceIdValue
in classIdScriptableObject
-
fillConstructorProperties
- Overrides:
fillConstructorProperties
in classIdScriptableObject
-
initPrototypeId
protected void initPrototypeId(int id) - Overrides:
initPrototypeId
in classIdScriptableObject
-
execIdCall
public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) Description copied from class:IdScriptableObject
'thisObj' will be null if invoked as constructor, in which case * instance of Scriptable should be returned.- Specified by:
execIdCall
in interfaceIdFunctionCall
- Overrides:
execIdCall
in classIdScriptableObject
-
realThis
-
tagify
private static String tagify(Context cx, Scriptable thisObj, IdFunctionObject f, String tag, String attribute, Object[] args) -
toCharSequence
-
toString
-
get
Description copied from class:ScriptableObject
Returns the value of the indexed property or NOT_FOUND.- Specified by:
get
in interfaceScriptable
- Overrides:
get
in classScriptableObject
- Parameters:
index
- the numeric index for the propertystart
- the object in which the lookup began- Returns:
- the value of the property (may be null), or NOT_FOUND
- See Also:
-
put
Description copied from class:ScriptableObject
Sets the value of the indexed property, creating it if need be.- Specified by:
put
in interfaceScriptable
- Overrides:
put
in classScriptableObject
- Parameters:
index
- the numeric index for the propertystart
- the object whose property is being setvalue
- value to set the property to- See Also:
-
has
Description copied from class:ScriptableObject
Returns true if the property index is defined.- Specified by:
has
in interfaceScriptable
- Overrides:
has
in classScriptableObject
- Parameters:
index
- the numeric index for the propertystart
- the object in which the lookup began- Returns:
- true if and only if the property was found in the object
- See Also:
-
getAttributes
public int getAttributes(int index) Description copied from class:ScriptableObject
Get the attributes of an indexed property.- Overrides:
getAttributes
in classScriptableObject
- Parameters:
index
- the numeric index for the property- Returns:
- the bitset of attributes
- See Also:
-
getIds
- Overrides:
getIds
in classIdScriptableObject
-
getOwnPropertyDescriptor
- Overrides:
getOwnPropertyDescriptor
in classIdScriptableObject
-
defaultIndexPropertyDescriptor
-
js_indexOf
-
js_lastIndexOf
-
js_substring
-
getLength
int getLength() -
js_substr
-
js_concat
-
js_slice
-
js_repeat
-
js_pad
private static String js_pad(Context cx, Scriptable thisObj, IdFunctionObject f, Object[] args, boolean atStart) -
findPrototypeId
- Overrides:
findPrototypeId
in classIdScriptableObject
-
js_raw
String.raw (template, ...substitutions)
22.1.2.4 String.raw [Draft ECMA-262 / April 28, 2021]
-
findPrototypeId
- Overrides:
findPrototypeId
in classIdScriptableObject
-