Package jsonvalues

Class MutableJsons


  • public class MutableJsons
    extends Object
    Factory to create mutable jsons. New factories can be created with different map and seq implementations using the methods withMap(Class) and withSeq(Class).
    • Method Detail

      • toMutable

        public Json<?> toMutable​(Json<?> json)
        converts the given json using this factory to an mutable one, if it's not mutable, returning the same instance otherwise.
        Parameters:
        json - the given json
        Returns:
        a mutable json
      • parse

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

        public Try parse​(String str,
                         ParseBuilder builder)
        Tries to parse the string into an immutable json, performing the specified transformations while the parsing.
        Parameters:
        str - the string that will be parsed
        builder - a builder with the transformations that will be applied during the parsing
        Returns:
        a Try computation
      • withMap

        public MutableJsons withMap​(Class<? extends MutableMap> map)
        returns a new factory of mutable Json using as underlying data structure to store elements of Json objects the given as a parameter
        Parameters:
        map - the underlying data structure to store elements of Json objects in the factory
        Returns:
        a new factory of mutable Jsons
      • withSeq

        public MutableJsons withSeq​(Class<? extends MutableSeq> seq)
        returns a new factory of mutable Json using as underlying data structure to store elements of Json arrays the given as a parameter
        Parameters:
        seq - the underlying data structure to store elements of Json arrays in the factory
        Returns:
        a new factory of mutable Jsons