Package org.mozilla.javascript.xmlimpl
Class XMLObjectImpl
java.lang.Object
org.mozilla.javascript.ScriptableObject
org.mozilla.javascript.IdScriptableObject
org.mozilla.javascript.xml.XMLObject
org.mozilla.javascript.xmlimpl.XMLObjectImpl
- All Implemented Interfaces:
Serializable
,ConstProperties
,DebuggableObject
,IdFunctionCall
,Scriptable
,SymbolScriptable
This abstract class describes what all XML objects (XML, XMLList) should
have in common.
- See Also:
-
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 XMLLibImpl
private static final int
private boolean
private static final long
private static final Object
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
ConstructorsModifierConstructorDescriptionprotected
XMLObjectImpl
(XMLLibImpl lib, Scriptable scope, XMLObject prototype) -
Method Summary
Modifier and TypeMethodDescription(package private) abstract void
addMatches
(XMLList rv, XMLName name) final Object
Custom+
operator.private static Object
(package private) abstract XMLList
child
(int index) (package private) abstract XMLList
(package private) abstract XMLList
children()
(package private) abstract XMLList
comments()
(package private) abstract boolean
(package private) abstract XMLObjectImpl
copy()
(package private) final XML
(package private) final Namespace
createNamespace
(XmlNode.Namespace declaration) (package private) final Namespace[]
createNamespaces
(XmlNode.Namespace[] declarations) void
Removes a named property from the object.final boolean
Implementation of ECMAScript [[Delete]].(package private) abstract void
deleteXMLProperty
(XMLName name) ecmaDelete(cx, id) calls this after resolving when id to XMLName and checking it is not Uint32 index.(package private) final String
(package private) final XML
(package private) abstract XMLList
enterDotQuery
(Scriptable scope) Wrap this object into NativeWith to implement the .() query.enterWith
(Scriptable scope) Wrap this object into NativeWith to implement the with statement.protected final Object
equivalentValues
(Object value) XMLObject always compare with any value and equivalentValues never returnsScriptable.NOT_FOUND
for them but rather calls equivalentXml(value) and wrap the result as Boolean.(package private) abstract boolean
equivalentXml
(Object target) Test XML equality with target the target.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.(package private) final void
exportAsJSClass
(boolean sealed) protected int
get
(String name, Scriptable start) Returns the value of the named property or NOT_FOUND.final Object
Implementation of ECMAScript [[Get]]final Object
getDefaultValue
(Class<?> hint) Implements the [[DefaultValue]] internal method.getFunctionProperty
(Context cx, int id) getFunctionProperty
(Context cx, String name) (package private) XMLLibImpl
getLib()
private XMLList
getMatches
(XMLName name) final Scriptable
Returns the parent (enclosing) scope of the object.(package private) final XmlProcessor
final Scriptable
Returns the prototype of the object.(package private) abstract XML
getXML()
(package private) abstract Object
getXMLProperty
(XMLName name) ecmaGet(cx, id) calls this after resolving when id to XMLName and checking it is not Uint32 index.boolean
has
(String name, Scriptable start) Returns true if the named property is defined.final boolean
Implementation of ECMAScript [[Has]](package private) abstract boolean
final boolean
hasInstance
(Scriptable scriptable) Implements the instanceof operator.(package private) abstract boolean
hasOwnProperty
(XMLName xmlName) (package private) abstract boolean
(package private) abstract boolean
hasXMLProperty
(XMLName name) ecmaHas(cx, id) calls this after resolving when id to XMLName and checking it is not Uint32 index.(package private) final void
initialize
(XMLLibImpl lib, Scriptable scope, XMLObject prototype) protected void
initPrototypeId
(int id) (package private) final boolean
protected abstract Object
jsConstructor
(Context cx, boolean inNewExpr, Object[] args) (package private) abstract int
length()
Generic reference to implement x.@y, x..y etc.Generic reference to implement x::ns, x.@ns::y, x..@ns::y etc.(package private) final QName
(package private) final QName
newQName
(XmlNode.QName name) (package private) final XML
newTextElementXML
(XmlNode reference, XmlNode.QName qname, String value) (package private) final XML
(package private) final XML
newXMLFromJs
(Object inputObject) (package private) final XMLList
(package private) final XMLList
(package private) abstract void
(package private) abstract Object
parent()
(package private) abstract XMLList
processingInstructions
(XMLName xmlName) (package private) abstract boolean
propertyIsEnumerable
(Object member) void
put
(String name, Scriptable start, Object value) Sets the value of the named property, creating it if need be.final void
Implementation of ECMAScript [[Put]](package private) abstract void
putXMLProperty
(XMLName name, Object value) ecmaPut(cx, id, value) calls this after resolving when id to XMLName and checking it is not Uint32 index.final void
setParentScope
(Scriptable parent) Sets the parent (enclosing) scope of the object.final void
setPrototype
(Scriptable prototype) Sets the prototype of the object.(package private) abstract XMLList
text()
private Object[]
toObjectArray
(Object[] typed) (package private) abstract String
toSource
(int indent) abstract String
toString()
(package private) abstract String
(package private) abstract Object
valueOf()
(package private) XML
xmlFromNode
(XmlNode node) private void
xmlMethodNotFound
(Object object, String name) Methods inherited from class org.mozilla.javascript.xml.XMLObject
getExtraMethodSource, getTypeOf
Methods inherited from class org.mozilla.javascript.IdScriptableObject
activatePrototypeMap, addIdFunctionProperty, defaultGet, defaultHas, defaultPut, defineOwnProperty, delete, ensureType, exportAsJSClass, fillConstructorProperties, findInstanceIdInfo, findInstanceIdInfo, findPrototypeId, get, getAttributes, getAttributes, getInstanceIdName, getInstanceIdValue, getMaxInstanceId, getOwnPropertyDescriptor, has, hasPrototypeMap, initPrototypeConstructor, initPrototypeMethod, initPrototypeMethod, initPrototypeMethod, initPrototypeValue, initPrototypeValue, instanceIdInfo, put, setAttributes, setInstanceIdAttributes, setInstanceIdValue
Methods inherited from class org.mozilla.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getClassName, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getProperty, getProperty, getProperty, getPropertyIds, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, size
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
XMLOBJECT_TAG
-
lib
-
prototypeFlag
private boolean prototypeFlag -
Id_constructor
private static final int Id_constructor- See Also:
-
Id_addNamespace
private static final int Id_addNamespace- See Also:
-
Id_appendChild
private static final int Id_appendChild- See Also:
-
Id_attribute
private static final int Id_attribute- See Also:
-
Id_attributes
private static final int Id_attributes- See Also:
-
Id_child
private static final int Id_child- See Also:
-
Id_childIndex
private static final int Id_childIndex- See Also:
-
Id_children
private static final int Id_children- See Also:
-
Id_comments
private static final int Id_comments- See Also:
-
Id_contains
private static final int Id_contains- See Also:
-
Id_copy
private static final int Id_copy- See Also:
-
Id_descendants
private static final int Id_descendants- See Also:
-
Id_elements
private static final int Id_elements- See Also:
-
Id_inScopeNamespaces
private static final int Id_inScopeNamespaces- See Also:
-
Id_insertChildAfter
private static final int Id_insertChildAfter- See Also:
-
Id_insertChildBefore
private static final int Id_insertChildBefore- See Also:
-
Id_hasOwnProperty
private static final int Id_hasOwnProperty- See Also:
-
Id_hasComplexContent
private static final int Id_hasComplexContent- See Also:
-
Id_hasSimpleContent
private static final int Id_hasSimpleContent- See Also:
-
Id_length
private static final int Id_length- See Also:
-
Id_localName
private static final int Id_localName- See Also:
-
Id_name
private static final int Id_name- See Also:
-
Id_namespace
private static final int Id_namespace- See Also:
-
Id_namespaceDeclarations
private static final int Id_namespaceDeclarations- See Also:
-
Id_nodeKind
private static final int Id_nodeKind- See Also:
-
Id_normalize
private static final int Id_normalize- See Also:
-
Id_parent
private static final int Id_parent- See Also:
-
Id_prependChild
private static final int Id_prependChild- See Also:
-
Id_processingInstructions
private static final int Id_processingInstructions- See Also:
-
Id_propertyIsEnumerable
private static final int Id_propertyIsEnumerable- See Also:
-
Id_removeNamespace
private static final int Id_removeNamespace- See Also:
-
Id_replace
private static final int Id_replace- See Also:
-
Id_setChildren
private static final int Id_setChildren- See Also:
-
Id_setLocalName
private static final int Id_setLocalName- See Also:
-
Id_setName
private static final int Id_setName- See Also:
-
Id_setNamespace
private static final int Id_setNamespace- See Also:
-
Id_text
private static final int Id_text- See Also:
-
Id_toString
private static final int Id_toString- See Also:
-
Id_toSource
private static final int Id_toSource- See Also:
-
Id_toXMLString
private static final int Id_toXMLString- See Also:
-
Id_valueOf
private static final int Id_valueOf- See Also:
-
MAX_PROTOTYPE_ID
private static final int MAX_PROTOTYPE_ID- See Also:
-
-
Constructor Details
-
XMLObjectImpl
-
-
Method Details
-
initialize
-
isPrototype
final boolean isPrototype() -
getLib
XMLLibImpl getLib() -
newXML
-
xmlFromNode
-
newXMLList
-
newXMLListFrom
-
getProcessor
-
newQName
-
newQName
-
createNamespace
-
createNamespaces
-
getPrototype
Description copied from class:ScriptableObject
Returns the prototype of the object.- Specified by:
getPrototype
in interfaceScriptable
- Overrides:
getPrototype
in classScriptableObject
- Returns:
- the prototype
-
setPrototype
Description copied from class:ScriptableObject
Sets the prototype of the object.- Specified by:
setPrototype
in interfaceScriptable
- Overrides:
setPrototype
in classScriptableObject
- Parameters:
prototype
- the prototype to set
-
getParentScope
Description copied from class:ScriptableObject
Returns the parent (enclosing) scope of the object.- Specified by:
getParentScope
in interfaceScriptable
- Overrides:
getParentScope
in classScriptableObject
- Returns:
- the parent scope
-
setParentScope
Description copied from class:ScriptableObject
Sets the parent (enclosing) scope of the object.- Specified by:
setParentScope
in interfaceScriptable
- Overrides:
setParentScope
in classScriptableObject
- Parameters:
parent
- the parent scope to set
-
getDefaultValue
Description copied from class:ScriptableObject
Implements the [[DefaultValue]] internal method.Note that the toPrimitive conversion is a no-op for every type other than Object, for which [[DefaultValue]] is called. See ECMA 9.1.
A
hint
of null means "no hint".- Specified by:
getDefaultValue
in interfaceScriptable
- Overrides:
getDefaultValue
in classScriptableObject
- Parameters:
hint
- the type hint- Returns:
- the default value for the object
See ECMA 8.6.2.6.
-
hasInstance
Description copied from class:ScriptableObject
Implements the instanceof operator.This operator has been proposed to ECMA.
- Specified by:
hasInstance
in interfaceScriptable
- Overrides:
hasInstance
in classScriptableObject
- Parameters:
scriptable
- The value that appeared on the LHS of the instanceof operator- Returns:
- true if "this" appears in value's prototype chain
-
hasXMLProperty
ecmaHas(cx, id) calls this after resolving when id to XMLName and checking it is not Uint32 index. -
getXMLProperty
ecmaGet(cx, id) calls this after resolving when id to XMLName and checking it is not Uint32 index. -
putXMLProperty
ecmaPut(cx, id, value) calls this after resolving when id to XMLName and checking it is not Uint32 index. -
deleteXMLProperty
ecmaDelete(cx, id) calls this after resolving when id to XMLName and checking it is not Uint32 index. -
equivalentXml
Test XML equality with target the target. -
addMatches
-
getMatches
-
getXML
-
child
-
child
-
children
-
comments
-
contains
-
copy
-
elements
-
hasOwnProperty
-
hasComplexContent
abstract boolean hasComplexContent() -
hasSimpleContent
abstract boolean hasSimpleContent() -
length
abstract int length() -
normalize
abstract void normalize() -
parent
-
processingInstructions
-
propertyIsEnumerable
-
text
-
toString
-
toSource
-
toXMLString
-
valueOf
-
jsConstructor
-
equivalentValues
XMLObject always compare with any value and equivalentValues never returnsScriptable.NOT_FOUND
for them but rather calls equivalentXml(value) and wrap the result as Boolean.- Overrides:
equivalentValues
in classScriptableObject
-
has
Implementation of ECMAScript [[Has]] -
has
Description copied from class:ScriptableObject
Returns true if the named property is defined.- Specified by:
has
in interfaceScriptable
- Overrides:
has
in classIdScriptableObject
- Parameters:
name
- the name of the propertystart
- the object in which the lookup began- Returns:
- true if and only if the property was found in the object
- See Also:
-
get
Implementation of ECMAScript [[Get]] -
get
Description copied from class:ScriptableObject
Returns the value of the named property or NOT_FOUND.If the property was created using defineProperty, the appropriate getter method is called.
- Specified by:
get
in interfaceScriptable
- Overrides:
get
in classIdScriptableObject
- Parameters:
name
- the name of the propertystart
- the object in which the lookup began- Returns:
- the value of the property (may be null), or NOT_FOUND
- See Also:
-
put
Implementation of ECMAScript [[Put]] -
put
Description copied from class:ScriptableObject
Sets the value of the named property, creating it if need be.If the property was created using defineProperty, the appropriate setter method is called.
If the property's attributes include READONLY, no action is taken. This method will actually set the property in the start object.
- Specified by:
put
in interfaceScriptable
- Overrides:
put
in classIdScriptableObject
- Parameters:
name
- the name of the propertystart
- the object whose property is being setvalue
- value to set the property to- See Also:
-
delete
Implementation of ECMAScript [[Delete]]. -
delete
Description copied from class:ScriptableObject
Removes a named property from the object.If the property is not found, or it has the PERMANENT attribute, no action is taken.
- Specified by:
delete
in interfaceScriptable
- Overrides:
delete
in classIdScriptableObject
- Parameters:
name
- the name of the property- See Also:
-
getFunctionProperty
- Specified by:
getFunctionProperty
in classXMLObject
-
getFunctionProperty
- Specified by:
getFunctionProperty
in classXMLObject
-
memberRef
Description copied from class:XMLObject
Generic reference to implement x.@y, x..y etc. -
memberRef
Generic reference to implement x::ns, x.@ns::y, x..@ns::y etc. -
enterWith
Description copied from class:XMLObject
Wrap this object into NativeWith to implement the with statement. -
enterDotQuery
Description copied from class:XMLObject
Wrap this object into NativeWith to implement the .() query.- Specified by:
enterDotQuery
in classXMLObject
-
addValues
Description copied from class:XMLObject
Custom+
operator. Should returnScriptable.NOT_FOUND
if this object does not have custom addition operator for the given value, or the result of the addition operation.The default implementation returns
Scriptable.NOT_FOUND
to indicate no custom addition operation. -
exportAsJSClass
final void exportAsJSClass(boolean sealed) -
findPrototypeId
- Overrides:
findPrototypeId
in classIdScriptableObject
-
initPrototypeId
protected void initPrototypeId(int id) - Overrides:
initPrototypeId
in classIdScriptableObject
-
toObjectArray
-
xmlMethodNotFound
-
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
-
arg
-
newTextElementXML
-
newXMLFromJs
-
ecmaToXml
-
ecmaEscapeAttributeValue
-
createEmptyXML
-