java.lang.Object
org.bzdev.util.JSObject
org.bzdev.obnaming.NJSObject
- All Implemented Interfaces:
JSOps
Simplified JavaScript-like object class.
Objects defined by scripting languages can be used to configure
instances of
NamedObjectFactory
. For this use, the objects
contain properties but any methods explicitly defined for the
objects are ignored. The types of the values that can be inserted
into this object are NamedObjectOps
, JSObject
,
JSArray
,Boolean
, Number
, and String
.
The class NJSUtilities.JSON
can be used to create instances
of NJSObject
and NJSArray
by reading from various
sources, and instances of these two classes in turn can be used to
configure a named-object factory, which can then create a named
object.
This class is similar to a Map
, but with some
run-time type checking. Entries in the map can be other instances
of JSObject
(instances of NJSObject
are preferred)
or instances of JSArray
(instances of NJSArray
are
preferred), allowing trees or directed graphs to be constructed.
Iterators will use the keys in the order in which they were
inserted.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.bzdev.util.JSObject
containsKey, entrySet, get, get, identity, keySet, put, put, put, put, put, putObject, remove, size, toKeyMap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bzdev.util.JSOps
nextIdentity
-
Constructor Details
-
NJSObject
public NJSObject()Constructor. -
NJSObject
Constructor sharing the same tables. This is used byNJSObject
.- Parameters:
base
- the JSObject whose tables should be used
-
-
Method Details
-
put
Insert a named object into this map.- Parameters:
key
- the keyobject
- the object- Returns:
- the previous object; null if there isn't one
-
put
Put an object into this map. The object may be null. If it is not null, it may be an instance ofNamedObjectOps
,String
,Boolean
,Number
,JSArray
, orJSObject
.- Overrides:
put
in classJSObject
- Parameters:
key
- the keyobject
- the object- Returns:
- the previous object; null if there was none
- Throws:
IllegalArgumentException
-