Type Hierarchy:
Satisfied Interfaces: Category, Cloneable<Map<Key,Item>>, Collection<Key->Item>, Correspondence<Object,Item>, Iterable<Element,Null>, Map<Key,Item>, MutableMap<String,String|Boolean|Integer|Float|Object|Array|NullInstance>

Represents a JSON Object

By: Stéphane Épardaud
Initializer
Object({<String->String|Boolean|Integer|Float|Object|Array|NullInstance>*} values = ...)
Parameters:
  • values = {}
Attributes
clone
shared actual Object clone

Obtain a clone of this object. For a mutable object, this should return a copy of the object. For an immutable object, it is acceptable to return the object itself.

Refined declaration: clone
hash
shared actual Integer hash

The hash value of the value, which allows the value to be an element of a hash-based set or key of a hash-based map. Implementations must respect the constraint that if x==y then x.hash==y.hash.

Refined declaration: hash
pretty
shared String pretty

Returns a pretty-printed serialised JSON representation

size
shared actual Integer size

The number of elements returned by the iterator of this iterable object, if the iterator terminates. In the case of an iterable whose elements are not countable, this operation never terminates.

Refined declaration: size
string
shared actual String string

Returns a serialised JSON representation

Refined declaration: string
Inherited Attributes
Attributes inherited from: Cloneable<Clone>
clone
Attributes inherited from: Collection<Element>
string
Attributes inherited from: Correspondence<Key,Item>
keys
Attributes inherited from: Iterable<Element,Absent>
coalesced, cycled, empty, first, indexed, last, rest, sequence, size, string
Attributes inherited from: Map<Key,Item>
hash, inverse, values
Methods
clear
shared actual void clear()

Remove every entry from this map, leaving an empty map.

Refined declaration: clear
equals
shared actual Boolean equals(Object that)

Determine if two values are equal. Implementations should respect the constraints that:

  • if x===y then x==y (reflexivity),
  • if x==y then y==x (symmetry),
  • if x==y and y==z then x==z (transitivity).

Furthermore it is recommended that implementations ensure that if x==y then x and y have the same concrete class.

Refined declaration: equals
get
shared actual Null|String|Boolean|Integer|Float|Object|Array|NullInstance get(Object key)

Returns the value defined for the given key, or null if there is no value defined for the given key.

Refined declaration: get
getArray
shared Array getArray(String key)

Returns an Array value.

Throws:
getArrayOrNull
shared Array? getArrayOrNull(String key)

Returns an Array value, unless the key does not exist, or the value is null.

Throws:
getBoolean
shared Boolean getBoolean(String key)

Returns an Boolean value.

Throws:
getBooleanOrNull
shared Boolean? getBooleanOrNull(String key)

Returns an Boolean value, unless the key does not exist, or the value is null.

Throws:
getFloat
shared Float getFloat(String key)

Returns an Float value.

Throws:
getFloatOrNull
shared Float? getFloatOrNull(String key)

Returns an Float value, unless the key does not exist, or the value is null.

Throws:
getInteger
shared Integer getInteger(String key)

Returns an Integer value.

Throws:
getIntegerOrNull
shared Integer? getIntegerOrNull(String key)

Returns an Integer value, unless the key does not exist, or the value is null.

Throws:
getObject
shared Object getObject(String key)

Returns an Object value.

Throws:
getObjectOrNull
shared Object? getObjectOrNull(String key)

Returns an Object value, unless the key does not exist, or the value is null.

Throws:
getString
shared String getString(String key)

Returns an String value.

Throws:
getStringOrNull
shared String? getStringOrNull(String key)

Returns an String value, unless the key does not exist, or the value is null.

Throws:
iterator
shared actual Iterator<String->String|Boolean|Integer|Float|Object|Array|NullInstance> iterator()

An iterator for the elements belonging to this container.

Refined declaration: iterator
put
shared actual Null|String|Boolean|Integer|Float|Object|Array|NullInstance put(String key, String|Boolean|Integer|Float|Object|Array|NullInstance item)

Add an entry to this map, overwriting any existing entry for the given key, and returning the previous value associated with the given key, if any, or null.

Refined declaration: put
putAll
shared actual void putAll({<String->String|Boolean|Integer|Float|Object|Array|NullInstance>*} entries)

Add the given entries to this map, overwriting any existing entries with the same keys.

Refined declaration: putAll
remove
shared actual Null|String|Boolean|Integer|Float|Object|Array|NullInstance remove(String key)

Remove the entry associated with the given key, if any, from this map, returning the value no longer associated with the given key, if any, or null.

Refined declaration: remove
Inherited Methods
Methods inherited from: Category
contains, containsAny, containsEvery
Methods inherited from: Correspondence<Key,Item>
defines, definesAny, definesEvery, get, items
Methods inherited from: Iterable<Element,Absent>
any, by, chain, collect, count, cycle, defaultNullElements, every, filter, find, findLast, fold, following, iterator, longerThan, map, repeat, select, shorterThan, skipping, skippingWhile, sort, taking, takingWhile
Methods inherited from: Map<Key,Item>
equals, mapItems
Methods inherited from: MutableMap<Key,Item>
clear, put, putAll, remove