Package jsonvalues

Class ParseOptions


  • public class ParseOptions
    extends Object
    Builder with different options to customize the parsing of a string into a json.
    • Constructor Detail

      • ParseOptions

        public ParseOptions()
    • Method Detail

      • builder

        public static ParseOptions builder()
        static factory method to create a builder to customize the parsing of a string into a json.
        Returns:
        a new builder instance
      • withElemFilter

        public ParseOptions withElemFilter​(Predicate<? super JsPair> filter)
        adds a predicate to this builder to filter the elements of the json to be parsed, removing those pairs that are evaluated to false on the predicate.
        Parameters:
        filter - the predicate to filter pair of elements.
        Returns:
        this ParseOptions builder
      • withKeyFilter

        public ParseOptions withKeyFilter​(Predicate<JsPath> keyFilter)
        adds a function to this builder to filter the keys of the json to be parsed.
        Parameters:
        keyFilter - the predicate to filter
        Returns:
        this ParseOptions builder
      • withKeyMap

        public ParseOptions withKeyMap​(UnaryOperator<String> keyMap)
        adds a function to this builder to map the keys of the json to be parsed.
        Parameters:
        keyMap - the map function which takes as input the name of the key and returns the new key name
        Returns:
        this ParseOptions builder
      • withElemMap

        public ParseOptions withElemMap​(Function<JsPair,​JsElem> map)
        adds a function to this builder to map the elements of the json to be parsed
        Parameters:
        map - the map function which takes as input a JsPair and returns the new JsElem
        Returns:
        this ParseOptions builder