Interface Parser<T>

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default java.util.function.Consumer<java.lang.String> andApply​(java.util.function.Consumer<T> consumer)
      Make a string consumer to typed value consumer out of the converter.
      default Property.Putter andPut​(Parser.TypedPutter<T> putter)
      Make a property putter that calls a typed putter with the parsed value.
      default java.util.function.Consumer<java.lang.String> andPutAs​(Parser.TypedPutter<T> putter, java.lang.String key)
      Make a consumer that puts a specific value with the typed putter.
      static Parser<java.lang.Double> dbl()
      Make a double parser.
      static java.util.function.Consumer<java.lang.String> dbl​(java.util.function.Consumer<java.lang.Double> target)
      Make a 64-bit integer parsing consumer.
      static Parser<java.io.File> dir()
      Make a file parser that refers to an existing directory.
      static java.util.function.Consumer<java.lang.String> dir​(java.util.function.Consumer<java.io.File> target)
      Make a file parsing consumer that refers to an existing directory.
      static Parser<java.nio.file.Path> dirPath()
      Make a file parser that refers to an existing directory.
      static java.util.function.Consumer<java.lang.String> dirPath​(java.util.function.Consumer<java.nio.file.Path> target)
      Make a file parsing consumer that refers to an existing directory.
      static Parser<java.io.File> file()
      Make a file parser that refers to an existing file.
      static java.util.function.Consumer<java.lang.String> file​(java.util.function.Consumer<java.io.File> target)
      Make a file parsing consumer that refers to an existing file.
      static Parser<java.nio.file.Path> filePath()
      Make a file parser that refers to an existing file.
      static java.util.function.Consumer<java.lang.String> filePath​(java.util.function.Consumer<java.nio.file.Path> target)
      Make a file parsing consumer that refers to an existing file.
      static Parser<java.lang.Integer> i32()
      Make a 32-bit integer parser.
      static java.util.function.Consumer<java.lang.String> i32​(java.util.function.Consumer<java.lang.Integer> target)
      Make a 32-bit integer parsing consumer.
      static Parser<java.lang.Long> i64()
      Make a 64-bit integer parser.
      static java.util.function.Consumer<java.lang.String> i64​(java.util.function.Consumer<java.lang.Long> target)
      Make a 64-bit integer parsing consumer.
      static <E extends java.lang.Enum<E>>
      Parser<E>
      oneOf​(java.lang.Class<E> klass)
      Make an enum value parsing consumer.
      static <E extends java.lang.Enum<E>>
      java.util.function.Consumer<java.lang.String>
      oneOf​(java.lang.Class<E> klass, java.util.function.Consumer<E> target)
      Make a file parsing consumer that refers to an existing file.
      static Parser<java.io.File> outputDir()
      Make a parser that refers either to a non-existing entry or an existing directory, but not a file or special device.
      static java.util.function.Consumer<java.lang.String> outputDir​(java.util.function.Consumer<java.io.File> target)
      Make a parsing consumer that refers either to a non-existing entry or an existing directory, but not a file or special device.
      static Parser<java.io.File> outputFile()
      Make a file parser that refers either to a non-existing entry or an existing file, but not a directory or special device.
      static java.util.function.Consumer<java.lang.String> outputFile​(java.util.function.Consumer<java.io.File> target)
      Make a file parsing consumer that refers either to a non-existing entry or an existing file, but not a directory or special device.
      T parse​(java.lang.String value)
      Parse the value into a typed instance.
      static Parser<java.nio.file.Path> path()
      Make a parser that parses a path.
      static java.util.function.Consumer<java.lang.String> path​(java.util.function.Consumer<java.nio.file.Path> target)
      Make a parsing consumer that parses a path.
      static java.util.function.Consumer<java.lang.String> putAs​(Property.Putter putter, java.lang.String key)
      Convenience method to put a specific value into a putter.
    • Method Detail

      • parse

        T parse​(java.lang.String value)
        Parse the value into a typed instance.
        Parameters:
        value - The string value.
        Returns:
        The typed instance.
        Throws:
        ArgumentException - If the parsing failed.
      • andApply

        default java.util.function.Consumer<java.lang.String> andApply​(java.util.function.Consumer<T> consumer)
        Make a string consumer to typed value consumer out of the converter.
        Parameters:
        consumer - The consumer to wrap.
        Returns:
        The string consumer.
      • andPut

        default Property.Putter andPut​(Parser.TypedPutter<T> putter)
        Make a property putter that calls a typed putter with the parsed value.
        Parameters:
        putter - The typed putter.
        Returns:
        The property putter.
      • andPutAs

        default java.util.function.Consumer<java.lang.String> andPutAs​(Parser.TypedPutter<T> putter,
                                                                       java.lang.String key)
        Make a consumer that puts a specific value with the typed putter.
        Parameters:
        putter - the typed putter.
        key - The property key.
        Returns:
        The string consumer.
      • putAs

        static java.util.function.Consumer<java.lang.String> putAs​(Property.Putter putter,
                                                                   java.lang.String key)
        Convenience method to put a specific value into a putter.
        Parameters:
        putter - The putter.
        key - The key to put.
        Returns:
        The string consumer.
      • i32

        static Parser<java.lang.Integer> i32()
        Make a 32-bit integer parser.
        Returns:
        The parser.
      • i32

        static java.util.function.Consumer<java.lang.String> i32​(java.util.function.Consumer<java.lang.Integer> target)
        Make a 32-bit integer parsing consumer.
        Parameters:
        target - The target consumer.
        Returns:
        The consumer wrapper.
      • i64

        static Parser<java.lang.Long> i64()
        Make a 64-bit integer parser.
        Returns:
        The parser.
      • i64

        static java.util.function.Consumer<java.lang.String> i64​(java.util.function.Consumer<java.lang.Long> target)
        Make a 64-bit integer parsing consumer.
        Parameters:
        target - The target consumer.
        Returns:
        The consumer wrapper.
      • dbl

        static Parser<java.lang.Double> dbl()
        Make a double parser.
        Returns:
        The parser.
      • dbl

        static java.util.function.Consumer<java.lang.String> dbl​(java.util.function.Consumer<java.lang.Double> target)
        Make a 64-bit integer parsing consumer.
        Parameters:
        target - The target consumer.
        Returns:
        The consumer wrapper.
      • oneOf

        static <E extends java.lang.Enum<E>> Parser<E> oneOf​(java.lang.Class<E> klass)
        Make an enum value parsing consumer.
        Type Parameters:
        E - The enum type.
        Parameters:
        klass - The enum class.
        Returns:
        The parser.
      • oneOf

        static <E extends java.lang.Enum<E>> java.util.function.Consumer<java.lang.String> oneOf​(java.lang.Class<E> klass,
                                                                                                 java.util.function.Consumer<E> target)
        Make a file parsing consumer that refers to an existing file.
        Type Parameters:
        E - The enum type.
        Parameters:
        klass - The enum class.
        target - The target consumer.
        Returns:
        The consumer wrapper.
      • file

        static Parser<java.io.File> file()
        Make a file parser that refers to an existing file.
        Returns:
        The parser.
      • file

        static java.util.function.Consumer<java.lang.String> file​(java.util.function.Consumer<java.io.File> target)
        Make a file parsing consumer that refers to an existing file.
        Parameters:
        target - The target consumer.
        Returns:
        The consumer wrapper.
      • filePath

        static Parser<java.nio.file.Path> filePath()
        Make a file parser that refers to an existing file.
        Returns:
        The parser.
      • filePath

        static java.util.function.Consumer<java.lang.String> filePath​(java.util.function.Consumer<java.nio.file.Path> target)
        Make a file parsing consumer that refers to an existing file.
        Parameters:
        target - The target consumer.
        Returns:
        The consumer wrapper.
      • dir

        static Parser<java.io.File> dir()
        Make a file parser that refers to an existing directory.
        Returns:
        The consumer wrapper.
      • dir

        static java.util.function.Consumer<java.lang.String> dir​(java.util.function.Consumer<java.io.File> target)
        Make a file parsing consumer that refers to an existing directory.
        Parameters:
        target - The target consumer.
        Returns:
        The parser.
      • dirPath

        static Parser<java.nio.file.Path> dirPath()
        Make a file parser that refers to an existing directory.
        Returns:
        The consumer wrapper.
      • dirPath

        static java.util.function.Consumer<java.lang.String> dirPath​(java.util.function.Consumer<java.nio.file.Path> target)
        Make a file parsing consumer that refers to an existing directory.
        Parameters:
        target - The target consumer.
        Returns:
        The parser.
      • outputFile

        static Parser<java.io.File> outputFile()
        Make a file parser that refers either to a non-existing entry or an existing file, but not a directory or special device.
        Returns:
        The parser.
      • outputFile

        static java.util.function.Consumer<java.lang.String> outputFile​(java.util.function.Consumer<java.io.File> target)
        Make a file parsing consumer that refers either to a non-existing entry or an existing file, but not a directory or special device.
        Parameters:
        target - The target consumer.
        Returns:
        The consumer wrapper.
      • outputDir

        static Parser<java.io.File> outputDir()
        Make a parser that refers either to a non-existing entry or an existing directory, but not a file or special device.
        Returns:
        The parser.
      • outputDir

        static java.util.function.Consumer<java.lang.String> outputDir​(java.util.function.Consumer<java.io.File> target)
        Make a parsing consumer that refers either to a non-existing entry or an existing directory, but not a file or special device.
        Parameters:
        target - The target consumer.
        Returns:
        The consumer wrapper.
      • path

        static Parser<java.nio.file.Path> path()
        Make a parser that parses a path.
        Returns:
        The parser.
      • path

        static java.util.function.Consumer<java.lang.String> path​(java.util.function.Consumer<java.nio.file.Path> target)
        Make a parsing consumer that parses a path.
        Parameters:
        target - The target consumer.
        Returns:
        The consumer wrapper.