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 ScriptableObject
ScriptableObject.KeyComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final longprivate CharSequenceprivate static final Objectprivate static final intFields inherited from class ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTFields inherited from interface Scriptable
NOT_FOUND -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ScriptableObjectexecIdCall(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 voidprotected intMap name to id of instance property.protected intprotected intget(int index, Scriptable start) Returns the value of the indexed property or NOT_FOUND.intgetAttributes(int index) Get the attributes of an indexed property.Return the name of the class.protected Object[]getIds(boolean nonEnumerable, boolean getSymbols) protected StringgetInstanceIdName(int id) Map id back to property name it defines.protected ObjectgetInstanceIdValue(int id) Get id value.(package private) intprotected intGet maximum id findInstanceIdInfo can generate.protected ScriptableObjectgetOwnPropertyDescriptor(Context cx, Object id) booleanhas(int index, Scriptable start) Returns true if the property index is defined.(package private) static voidinit(Scriptable scope, boolean sealed) protected voidinitPrototypeId(int id) private static Stringprivate static intjs_indexOf(int methodId, String target, Object[] args) private static intjs_lastIndexOf(String target, Object[] args) private static Stringjs_pad(Context cx, Scriptable thisObj, IdFunctionObject f, Object[] args, boolean atStart) private static CharSequencejs_raw(Context cx, Scriptable scope, Object[] args) String.raw (template, ...substitutions)private static Stringjs_repeat(Context cx, Scriptable thisObj, IdFunctionObject f, Object[] args) private static CharSequencejs_slice(CharSequence target, Object[] args) private static CharSequencejs_substr(CharSequence target, Object[] args) private static CharSequencejs_substring(Context cx, CharSequence target, Object[] args) voidput(int index, Scriptable start, Object value) Sets the value of the indexed property, creating it if need be.private static NativeStringrealThis(Scriptable thisObj, IdFunctionObject f) private static Stringtagify(Context cx, Scriptable thisObj, IdFunctionObject f, String tag, String attribute, Object[] args) toString()Methods inherited from class 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, setInstanceIdValueMethods inherited from class 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:ScriptableObjectReturn the name of the class.This is typically the same name as the constructor. Classes extending ScriptableObject must implement this abstract method.
- Specified by:
getClassNamein interfaceScriptable- Specified by:
getClassNamein classScriptableObject
-
getMaxInstanceId
protected int getMaxInstanceId()Description copied from class:IdScriptableObjectGet maximum id findInstanceIdInfo can generate.- Overrides:
getMaxInstanceIdin classIdScriptableObject
-
findInstanceIdInfo
Description copied from class:IdScriptableObjectMap name to id of instance property. Should return 0 if not found or the result ofIdScriptableObject.instanceIdInfo(int, int).- Overrides:
findInstanceIdInfoin classIdScriptableObject
-
getInstanceIdName
Description copied from class:IdScriptableObjectMap id back to property name it defines.- Overrides:
getInstanceIdNamein classIdScriptableObject
-
getInstanceIdValue
Description copied from class:IdScriptableObjectGet 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:
getInstanceIdValuein classIdScriptableObject
-
fillConstructorProperties
- Overrides:
fillConstructorPropertiesin classIdScriptableObject
-
initPrototypeId
protected void initPrototypeId(int id) - Overrides:
initPrototypeIdin 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:
execIdCallin interfaceIdFunctionCall- Overrides:
execIdCallin 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:ScriptableObjectReturns the value of the indexed property or NOT_FOUND.- Specified by:
getin interfaceScriptable- Overrides:
getin 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:ScriptableObjectSets the value of the indexed property, creating it if need be.- Specified by:
putin interfaceScriptable- Overrides:
putin 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:ScriptableObjectReturns true if the property index is defined.- Specified by:
hasin interfaceScriptable- Overrides:
hasin 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:ScriptableObjectGet the attributes of an indexed property.- Overrides:
getAttributesin classScriptableObject- Parameters:
index- the numeric index for the property- Returns:
- the bitset of attributes
- See Also:
-
getIds
- Overrides:
getIdsin classIdScriptableObject
-
getOwnPropertyDescriptor
- Overrides:
getOwnPropertyDescriptorin 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:
findPrototypeIdin classIdScriptableObject
-
js_raw
String.raw (template, ...substitutions)
22.1.2.4 String.raw [Draft ECMA-262 / April 28, 2021]
-
findPrototypeId
- Overrides:
findPrototypeIdin classIdScriptableObject
-