Package jsonvalues

Class MutableJsons.MutableJsObjs

  • Enclosing class:
    MutableJsons

    public class MutableJsons.MutableJsObjs
    extends Object
    represents a factory of mutable Json objects
    • Method Detail

      • toMutable

        public JsObj toMutable​(JsObj map)
      • collector

        public Collector<JsPair,​JsObj,​JsObj> collector()
        Returns a collector that accumulates the pairs from a stream into an mutable object.
        Returns:
        a Collector which collects all the pairs of elements into an mutable JsObj, in encounter order
      • empty

        public JsObj empty()
        Returns the immutable empty object. The same instance is always returned.
        Returns:
        the singleton immutable empty JsObj
      • parse

        public TryObj parse​(String str)
        Tries to parse the string into an immutable object.
        Parameters:
        str - the string to be parsed
        Returns:
        a TryObj computation
      • parse

        public TryObj parse​(String str,
                            ParseBuilder builder)
        Tries to parse the string into an immutable object, performing the specified transformations during the parsing. It's faster to do certain operations right while the parsing instead of doing the parsing and applying them later.
        Parameters:
        str - string to be parsed
        builder - builder with the transformations that will be applied during the parsing
        Returns:
        a TryObj computation
      • of

        public JsObj of​(String key,
                        JsElem el)
        Returns a one-element mutable object.
        Parameters:
        key - name of a key
        el - JsElem to be associated to the key
        Returns:
        an mutable one-element JsObj
        Throws:
        UserError - if an elem is an immutable Json
      • of

        public JsObj of​(String key1,
                        JsElem el1,
                        String key2,
                        JsElem el2)
        Returns a two-element mutable object.
        Parameters:
        key1 - name of a key
        el1 - JsElem to be associated to the key1
        key2 - name of a key
        el2 - JsElem to be associated to the key2
        Returns:
        an mutable two-element JsObj
        Throws:
        UserError - if an elem is an immutable Json
      • of

        public JsObj of​(String key1,
                        JsElem el1,
                        String key2,
                        JsElem el2,
                        String key3,
                        JsElem el3)
        Returns a three-element mutable object.
        Parameters:
        key1 - name of a key
        el1 - JsElem to be associated to the key1
        key2 - name of a key
        el2 - JsElem to be associated to the key2
        key3 - name of a key
        el3 - JsElem to be associated to the key3
        Returns:
        an mutable three-element JsObj
        Throws:
        UserError - if an elem is an immutable Json
      • of

        public JsObj of​(String key1,
                        JsElem el1,
                        String key2,
                        JsElem el2,
                        String key3,
                        JsElem el3,
                        String key4,
                        JsElem el4)
        Returns a four-element mutable object.
        Parameters:
        key1 - name of a key
        el1 - JsElem to be associated to the key1
        key2 - name of a key
        el2 - JsElem to be associated to the key2
        key3 - name of a key
        el3 - JsElem to be associated to the key3
        key4 - name of a key
        el4 - JsElem to be associated to the key4
        Returns:
        an mutable four-element JsObj
        Throws:
        UserError - if an elem is an immutable Json
      • of

        public JsObj of​(String key1,
                        JsElem el1,
                        String key2,
                        JsElem el2,
                        String key3,
                        JsElem el3,
                        String key4,
                        JsElem el4,
                        String key5,
                        JsElem el5)
        Returns a five-element mutable object.
        Parameters:
        key1 - name of a key
        el1 - JsElem to be associated to the key1
        key2 - name of a key
        el2 - JsElem to be associated to the key2
        key3 - name of a key
        el3 - JsElem to be associated to the key3
        key4 - name of a key
        el4 - JsElem to be associated to the key4
        key5 - name of a key
        el5 - JsElem to be associated to the key5
        Returns:
        an mutable five-element JsObj
        Throws:
        UserError - if an elem is an immutable Json
      • of

        public JsObj of​(String key1,
                        JsElem el1,
                        String key2,
                        JsElem el2,
                        String key3,
                        JsElem el3,
                        String key4,
                        JsElem el4,
                        String key5,
                        JsElem el5,
                        String key6,
                        JsElem el6)
        Returns a six-element mutable object.
        Parameters:
        key1 - name of a key
        el1 - JsElem to be associated to the key1
        key2 - name of a key
        el2 - JsElem to be associated to the key2
        key3 - name of a key
        el3 - JsElem to be associated to the key3
        key4 - name of a key
        el4 - JsElem to be associated to the key4
        key5 - name of a key
        el5 - JsElem to be associated to the key5
        key6 - name of a key
        el6 - JsElem to be associated to the key6
        Returns:
        an mutable six-element JsObj
        Throws:
        UserError - if an elem is an immutable Json
      • of

        public JsObj of​(JsPair pair,
                        JsPair... others)
        Returns an immutable object from one or more pairs.
        Parameters:
        pair - a pair
        others - more optional pairs
        Returns:
        an immutable JsObject
        Throws:
        UserError - if an elem of a pair is mutable