Interface StringValueParser

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 StringValueParser
String value parser.
  • Method Summary

    Modifier and Type
    Method
    Description
    <R> Optional<R>
    parse(String val, Class<R> type)
    Parse the string into a type R instance.
  • Method Details

    • parse

      <R> Optional<R> parse(String val, Class<R> type)
      Parse the string into a type R instance. Note that this method returns an optional since some parsers may choose to map to null for certain types and value combinations (e.g., empty string "" mapping to null value).
      Type Parameters:
      R - the return type
      Parameters:
      val - the string value to parse
      type - the type of the result expected
      Returns:
      the optional nullable parsed value
      Throws:
      IllegalArgumentException - if the format is not parsable or the return type is not supported