forked from mozilla/rhino
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXMLObject.java
More file actions
115 lines (95 loc) · 3.56 KB
/
XMLObject.java
File metadata and controls
115 lines (95 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.javascript.xml;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.IdScriptableObject;
import org.mozilla.javascript.NativeWith;
import org.mozilla.javascript.Ref;
import org.mozilla.javascript.Scriptable;
/**
* This Interface describes what all XML objects (XML, XMLList) should have in common.
*
*/
public abstract class XMLObject extends IdScriptableObject
{
private static final long serialVersionUID = 8455156490438576500L;
public XMLObject()
{
}
public XMLObject(Scriptable scope, Scriptable prototype)
{
super(scope, prototype);
}
/**
* Implementation of ECMAScript [[Has]].
*/
public abstract boolean has(Context cx, Object id);
/**
* Implementation of ECMAScript [[Get]].
*/
public abstract Object get(Context cx, Object id);
/**
* Implementation of ECMAScript [[Put]].
*/
public abstract void put(Context cx, Object id, Object value);
/**
* Implementation of ECMAScript [[Delete]].
*/
public abstract boolean delete(Context cx, Object id);
public abstract Object getFunctionProperty(Context cx, String name);
public abstract Object getFunctionProperty(Context cx, int id);
/**
* Return an additional object to look for methods that runtime should
* consider during method search. Return null if no such object available.
*/
public abstract Scriptable getExtraMethodSource(Context cx);
/**
* Generic reference to implement x.@y, x..y etc.
*/
public abstract Ref memberRef(Context cx, Object elem,
int memberTypeFlags);
/**
* Generic reference to implement x::ns, x.@ns::y, x..@ns::y etc.
*/
public abstract Ref memberRef(Context cx, Object namespace, Object elem,
int memberTypeFlags);
/**
* Wrap this object into NativeWith to implement the with statement.
*/
public abstract NativeWith enterWith(Scriptable scope);
/**
* Wrap this object into NativeWith to implement the .() query.
*/
public abstract NativeWith enterDotQuery(Scriptable scope);
/**
* Custom <code>+</code> operator.
* Should return {@link Scriptable#NOT_FOUND} if this object does not have
* custom addition operator for the given value,
* or the result of the addition operation.
* <p>
* The default implementation returns {@link Scriptable#NOT_FOUND}
* to indicate no custom addition operation.
*
* @param cx the Context object associated with the current thread.
* @param thisIsLeft if true, the object should calculate this + value
* if false, the object should calculate value + this.
* @param value the second argument for addition operation.
*/
public Object addValues(Context cx, boolean thisIsLeft, Object value)
{
return Scriptable.NOT_FOUND;
}
/**
* Gets the value returned by calling the typeof operator on this object.
* @see org.mozilla.javascript.ScriptableObject#getTypeOf()
* @return "xml" or "undefined" if {@link #avoidObjectDetection()} returns <code>true</code>
*/
@Override
public String getTypeOf()
{
return avoidObjectDetection() ? "undefined" : "xml";
}
}