Interface TypeParser<T>

Type Parameters:
T - the object value type produced by parse(CharSequence, int, int)
All Superinterfaces:
Function<CharSequence,T>, SliceParser<T>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface TypeParser<T> extends SliceParser<T>
Parses textual values into a target typed value.

The primary operation is slice parsing. Whole-sequence parsing delegates to the slice method, so type parsers can be used anywhere a SliceParser is expected without creating intermediate strings.

  • Method Details

    • parse

      T parse(CharSequence s, int start, int end)
      Parses a slice of a character sequence into an object value.
      Specified by:
      parse in interface SliceParser<T>
      Parameters:
      s - the source text
      start - the start index
      end - one past the last character in the slice
      Returns:
      the parsed value, or null when parsing fails
    • parse

      default T parse(ByteString s, int start, int end)
    • parse

      default T parse(ByteSequence s, int start, int end)
    • parse

      default T parse(CharSequence s)
      Parses a whole character sequence into an object value.
      Specified by:
      parse in interface SliceParser<T>
      Parameters:
      s - the source text
      Returns:
      the parsed value, or null when parsing fails
    • parseByte

      default byte parseByte(CharSequence s)
      Parses a whole character sequence into a byte value.
      Parameters:
      s - the source text
      Returns:
      the parsed byte
    • parseByte

      default byte parseByte(CharSequence s, int start, int end)
      Parses a slice of a character sequence into a byte value.
      Parameters:
      s - the source characters
      start - the start index
      end - one past the last character in the slice
      Returns:
      the parsed byte
    • parseByte

      default byte parseByte(ByteSequence s, int start, int end)
    • parseBoolean

      default boolean parseBoolean(CharSequence s)
      Parses a whole character sequence into a boolean value.
      Parameters:
      s - the source text
      Returns:
      the parsed boolean
    • parseBoolean

      default boolean parseBoolean(CharSequence s, int start, int end)
      Parses a slice of a character sequence into a boolean value.
      Parameters:
      s - the source text
      start - the start index
      end - one past the last character in the slice
      Returns:
      the parsed boolean
    • parseInt

      default int parseInt(CharSequence s)
      Parses a whole character sequence into an int value.
      Parameters:
      s - the source text
      Returns:
      the parsed int
    • parseInt

      default int parseInt(CharSequence s, int start, int end)
      Parses a slice of a character sequence into an int value.
      Parameters:
      s - the source text
      start - the start index
      end - one past the last character in the slice
      Returns:
      the parsed int
    • parseInt

      default int parseInt(ByteSequence s, int start, int end)
    • parseLong

      default long parseLong(CharSequence s)
      Parses a whole character sequence into a long value.
      Parameters:
      s - the source text
      Returns:
      the parsed long
    • parseLong

      default long parseLong(CharSequence s, int start, int end)
      Parses a slice of a character sequence into a long value.
      Parameters:
      s - the source text
      start - the start index
      end - one past the last character in the slice
      Returns:
      the parsed long
    • parseLong

      default long parseLong(ByteSequence s, int start, int end)
    • parseDouble

      default double parseDouble(CharSequence s)
      Parses a whole character sequence into a double value.
      Parameters:
      s - the source text
      Returns:
      the parsed double
    • parseDouble

      default double parseDouble(CharSequence s, int start, int end)
      Parses a slice of a character sequence into a double value.
      Parameters:
      s - the source text
      start - the start index
      end - one past the last character in the slice
      Returns:
      the parsed double