- All Known Implementing Classes:
ExpressionParser.ESPArray
,ExpressionParser.ESPObject
,JSArray
,JSObject
,NJSArray
,NJSObject
public interface JSOps
Common operations for JSObject and JSArray.
This interface is used primarily when a method's argument
could be either a instance of
JSArray
or
JSObject
, or a subclass of either of these two
classes.
The method \texttt{identity} can be used to return an integer code identifying an instance. The implementation should call \texttt{nextIdentity} in a constructor and use that value to ensure that each object gets a unique number.
-
Method Details
-
size
int size()Get the number of entries for this object. The number of entries for aJSArray
is the array length whereas the number of entries for aJSObject
is the number of properties it has.- Returns:
- the size (that is, the number of entries)
-
identity
long identity()Get an integer identifying an instance of a class.- Returns:
- the identity
-
nextIdentity
default long nextIdentity()Get an identity. This method should be used only by classes implementing this interface.- Returns:
- a new value to use as an identity
-