Module de.carne
Package de.carne.text

Interface Parser<T>

  • Type Parameters:
    T - the actual type to map to.
    All Superinterfaces:
    java.util.function.Function<java.lang.String,​T>
    All Known Implementing Classes:
    IntegerParser, LongParser

    public interface Parser<T>
    extends java.util.function.Function<java.lang.String,​T>
    Generic parser interface for mapping a String to a specific type T.
    • Method Detail

      • parse

        T parse​(java.lang.String s)
        Parses the submitted string.
        Parameters:
        s - the String to parse.
        Returns:
        the parse result.
        Throws:
        java.lang.RuntimeException - if the parse operation fails.
      • apply

        default T apply​(java.lang.String s)
        Specified by:
        apply in interface java.util.function.Function<java.lang.String,​T>