Package org.mozilla.javascript.xmlimpl
Class XMLList
- java.lang.Object
-
- org.mozilla.javascript.ScriptableObject
-
- org.mozilla.javascript.IdScriptableObject
-
- org.mozilla.javascript.xml.XMLObject
-
- org.mozilla.javascript.xmlimpl.XMLObjectImpl
-
- org.mozilla.javascript.xmlimpl.XMLList
-
- All Implemented Interfaces:
java.io.Serializable
,Callable
,ConstProperties
,Constructable
,DebuggableObject
,Function
,IdFunctionCall
,Scriptable
,SymbolScriptable
class XMLList extends XMLObjectImpl implements Function
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.mozilla.javascript.ScriptableObject
ScriptableObject.KeyComparator
-
-
Field Summary
Fields Modifier and Type Field Description private XmlNode.InternalList
_annos
(package private) static long
serialVersionUID
private XMLObjectImpl
targetObject
private XmlNode.QName
targetProperty
-
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 Constructor Description XMLList(XMLLibImpl lib, Scriptable scope, XMLObject prototype)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addMatches(XMLList rv, XMLName name)
(package private) void
addToList(java.lang.Object toAdd)
private java.lang.Object
applyOrCall(boolean isApply, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
java.lang.Object
call(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
Call the function.(package private) XMLList
child(int index)
(package private) XMLList
child(XMLName xmlName)
(package private) XMLList
children()
(package private) XMLList
comments()
Scriptable
construct(Context cx, Scriptable scope, java.lang.Object[] args)
Call the function as a constructor.(package private) boolean
contains(java.lang.Object xml)
(package private) XMLObjectImpl
copy()
void
delete(int index)
Removes the indexed property from the object.(package private) void
deleteXMLProperty(XMLName name)
ecmaDelete(cx, id) calls this after resolving when id to XMLName and checking it is not Uint32 index.(package private) XMLList
elements(XMLName name)
(package private) boolean
equivalentXml(java.lang.Object target)
Test XML equality with target the target.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.Scriptable
getExtraMethodSource(Context cx)
See ECMA 357, 11_2_2_1, Semantics, 3_e.java.lang.Object[]
getIds()
Returns an array of ids for the properties of the object.java.lang.Object[]
getIdsForDebug()
(package private) XmlNode.InternalList
getNodeList()
private XMLList
getPropertyList(XMLName name)
(package private) XML
getXML()
private XML
getXML(XmlNode.InternalList _annos, int index)
private XML
getXmlFromAnnotation(int index)
(package private) java.lang.Object
getXMLProperty(XMLName name)
ecmaGet(cx, id) calls this after resolving when id to XMLName and checking it is not Uint32 index.boolean
has(int index, Scriptable start)
Returns true if the property index is defined.(package private) boolean
hasComplexContent()
(package private) boolean
hasOwnProperty(XMLName xmlName)
(package private) boolean
hasSimpleContent()
(package private) boolean
hasXMLProperty(XMLName xmlName)
ecmaHas(cx, id) calls this after resolving when id to XMLName and checking it is not Uint32 index.private void
insert(int index, XML xml)
private void
internalRemoveFromList(int index)
(package private) XML
item(int index)
protected java.lang.Object
jsConstructor(Context cx, boolean inNewExpr, java.lang.Object[] args)
(package private) int
length()
(package private) void
normalize()
(package private) java.lang.Object
parent()
If list is empty, return undefined, if elements have different parents return undefined, If they all have the same parent, return that parent(package private) XMLList
processingInstructions(XMLName xmlName)
(package private) boolean
propertyIsEnumerable(java.lang.Object name)
void
put(int index, Scriptable start, java.lang.Object value)
Sets the value of the indexed property, creating it if need be.(package private) void
putXMLProperty(XMLName xmlName, java.lang.Object value)
ecmaPut(cx, id, value) calls this after resolving when id to XMLName and checking it is not Uint32 index.(package private) void
remove()
(package private) void
replace(int index, XML xml)
private void
replaceNode(XML xml, XML with)
private void
setAttribute(XMLName xmlName, java.lang.Object value)
(package private) void
setTargets(XMLObjectImpl object, XmlNode.QName property)
(package private) XMLList
text()
(package private) java.lang.String
toSource(int indent)
java.lang.String
toString()
(package private) java.lang.String
toXMLString()
(package private) java.lang.Object
valueOf()
-
Methods inherited from class org.mozilla.javascript.xmlimpl.XMLObjectImpl
addValues, createEmptyXML, createNamespace, createNamespaces, delete, delete, ecmaEscapeAttributeValue, ecmaToXml, enterDotQuery, enterWith, equivalentValues, execIdCall, exportAsJSClass, findPrototypeId, get, get, getDefaultValue, getFunctionProperty, getFunctionProperty, getLib, getParentScope, getProcessor, getPrototype, has, has, hasInstance, initialize, initPrototypeId, isPrototype, memberRef, memberRef, newQName, newQName, newTextElementXML, newXML, newXMLFromJs, newXMLList, newXMLListFrom, put, put, setParentScope, setPrototype, xmlFromNode
-
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, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getObjectPrototype, getProperty, getProperty, getProperty, getPropertyIds, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, 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, size
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.mozilla.javascript.Scriptable
delete, get, getDefaultValue, getParentScope, getPrototype, has, hasInstance, put, setParentScope, setPrototype
-
-
-
-
Field Detail
-
serialVersionUID
static final long serialVersionUID
- See Also:
- Constant Field Values
-
_annos
private XmlNode.InternalList _annos
-
targetObject
private XMLObjectImpl targetObject
-
targetProperty
private XmlNode.QName targetProperty
-
-
Constructor Detail
-
XMLList
XMLList(XMLLibImpl lib, Scriptable scope, XMLObject prototype)
-
-
Method Detail
-
getNodeList
XmlNode.InternalList getNodeList()
-
setTargets
void setTargets(XMLObjectImpl object, XmlNode.QName property)
-
getXmlFromAnnotation
private XML getXmlFromAnnotation(int index)
-
getXML
XML getXML()
- Specified by:
getXML
in classXMLObjectImpl
-
internalRemoveFromList
private void internalRemoveFromList(int index)
-
replace
void replace(int index, XML xml)
-
insert
private void insert(int index, XML xml)
-
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.
- Specified by:
getClassName
in interfaceScriptable
- Specified by:
getClassName
in classScriptableObject
-
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.- 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:
Scriptable.get(String,Scriptable)
-
hasXMLProperty
boolean hasXMLProperty(XMLName xmlName)
Description copied from class:XMLObjectImpl
ecmaHas(cx, id) calls this after resolving when id to XMLName and checking it is not Uint32 index.- Specified by:
hasXMLProperty
in classXMLObjectImpl
-
has
public boolean has(int index, Scriptable start)
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:
Scriptable.get(int, Scriptable)
,ScriptableObject.getProperty(Scriptable, int)
-
putXMLProperty
void putXMLProperty(XMLName xmlName, java.lang.Object value)
Description copied from class:XMLObjectImpl
ecmaPut(cx, id, value) calls this after resolving when id to XMLName and checking it is not Uint32 index.- Specified by:
putXMLProperty
in classXMLObjectImpl
-
getXMLProperty
java.lang.Object getXMLProperty(XMLName name)
Description copied from class:XMLObjectImpl
ecmaGet(cx, id) calls this after resolving when id to XMLName and checking it is not Uint32 index.- Specified by:
getXMLProperty
in classXMLObjectImpl
-
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.- 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:
Scriptable.has(int, Scriptable)
,Scriptable.get(int, Scriptable)
,ScriptableObject.putProperty(Scriptable, int, Object)
,Context.toObject(Object, Scriptable)
-
getXML
private XML getXML(XmlNode.InternalList _annos, int index)
-
deleteXMLProperty
void deleteXMLProperty(XMLName name)
Description copied from class:XMLObjectImpl
ecmaDelete(cx, id) calls this after resolving when id to XMLName and checking it is not Uint32 index.- Specified by:
deleteXMLProperty
in classXMLObjectImpl
-
delete
public void delete(int index)
Description copied from class:ScriptableObject
Removes the indexed 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 classScriptableObject
- Parameters:
index
- the numeric index for the property- See Also:
Scriptable.get(int, Scriptable)
,ScriptableObject.deleteProperty(Scriptable, int)
-
getIds
public java.lang.Object[] getIds()
Description copied from class:ScriptableObject
Returns an array of ids for the properties of the object.Any properties with the attribute DONTENUM are not listed.
- Specified by:
getIds
in interfaceScriptable
- Overrides:
getIds
in classScriptableObject
- Returns:
- an array of java.lang.Objects with an entry for every listed property. Properties accessed via an integer index will have a corresponding Integer entry in the returned array. Properties accessed by a String will have a String entry in the returned array.
-
getIdsForDebug
public java.lang.Object[] getIdsForDebug()
-
remove
void remove()
-
item
XML item(int index)
-
setAttribute
private void setAttribute(XMLName xmlName, java.lang.Object value)
-
addToList
void addToList(java.lang.Object toAdd)
-
child
XMLList child(int index)
- Specified by:
child
in classXMLObjectImpl
-
child
XMLList child(XMLName xmlName)
- Specified by:
child
in classXMLObjectImpl
-
addMatches
void addMatches(XMLList rv, XMLName name)
- Specified by:
addMatches
in classXMLObjectImpl
-
children
XMLList children()
- Specified by:
children
in classXMLObjectImpl
-
comments
XMLList comments()
- Specified by:
comments
in classXMLObjectImpl
-
elements
XMLList elements(XMLName name)
- Specified by:
elements
in classXMLObjectImpl
-
contains
boolean contains(java.lang.Object xml)
- Specified by:
contains
in classXMLObjectImpl
-
copy
XMLObjectImpl copy()
- Specified by:
copy
in classXMLObjectImpl
-
hasOwnProperty
boolean hasOwnProperty(XMLName xmlName)
- Specified by:
hasOwnProperty
in classXMLObjectImpl
-
hasComplexContent
boolean hasComplexContent()
- Specified by:
hasComplexContent
in classXMLObjectImpl
-
hasSimpleContent
boolean hasSimpleContent()
- Specified by:
hasSimpleContent
in classXMLObjectImpl
-
length
int length()
- Specified by:
length
in classXMLObjectImpl
-
normalize
void normalize()
- Specified by:
normalize
in classXMLObjectImpl
-
parent
java.lang.Object parent()
If list is empty, return undefined, if elements have different parents return undefined, If they all have the same parent, return that parent- Specified by:
parent
in classXMLObjectImpl
-
processingInstructions
XMLList processingInstructions(XMLName xmlName)
- Specified by:
processingInstructions
in classXMLObjectImpl
-
propertyIsEnumerable
boolean propertyIsEnumerable(java.lang.Object name)
- Specified by:
propertyIsEnumerable
in classXMLObjectImpl
-
text
XMLList text()
- Specified by:
text
in classXMLObjectImpl
-
toString
public java.lang.String toString()
- Specified by:
toString
in classXMLObjectImpl
-
toSource
java.lang.String toSource(int indent)
- Specified by:
toSource
in classXMLObjectImpl
-
toXMLString
java.lang.String toXMLString()
- Specified by:
toXMLString
in classXMLObjectImpl
-
valueOf
java.lang.Object valueOf()
- Specified by:
valueOf
in classXMLObjectImpl
-
equivalentXml
boolean equivalentXml(java.lang.Object target)
Description copied from class:XMLObjectImpl
Test XML equality with target the target.- Specified by:
equivalentXml
in classXMLObjectImpl
-
applyOrCall
private java.lang.Object applyOrCall(boolean isApply, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
jsConstructor
protected java.lang.Object jsConstructor(Context cx, boolean inNewExpr, java.lang.Object[] args)
- Specified by:
jsConstructor
in classXMLObjectImpl
-
getExtraMethodSource
public Scriptable getExtraMethodSource(Context cx)
See ECMA 357, 11_2_2_1, Semantics, 3_e.- Specified by:
getExtraMethodSource
in classXMLObject
-
call
public java.lang.Object call(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
Description copied from interface:Function
Call the function.Note that the array of arguments is not guaranteed to have length greater than 0.
- Specified by:
call
in interfaceCallable
- Specified by:
call
in interfaceFunction
- Parameters:
cx
- the current Context for this threadscope
- the scope to execute the function relative to. This is set to the value returned by getParentScope() except when the function is called from a closure.thisObj
- the JavaScriptthis
objectargs
- the array of arguments- Returns:
- the result of the call
-
construct
public Scriptable construct(Context cx, Scriptable scope, java.lang.Object[] args)
Description copied from interface:Function
Call the function as a constructor.This method is invoked by the runtime in order to satisfy a use of the JavaScript
new
operator. This method is expected to create a new object and return it.- Specified by:
construct
in interfaceConstructable
- Specified by:
construct
in interfaceFunction
- Parameters:
cx
- the current Context for this threadscope
- an enclosing scope of the caller except when the function is called from a closure.args
- the array of arguments- Returns:
- the allocated object
-
-