Class Parser<T>

java.lang.Object
org.midheaven.lang.Parser<T>
Type Parameters:
T - the type being parsed

public abstract class Parser<T> extends Object
Represents Parser.
  • Constructor Details

    • Parser

      public Parser()
  • Method Details

    • lowerCode

      public static <X> Parser<X> lowerCode(Function<String,X> factory)
      Performs lowerCode.
      Parameters:
      factory - the factory value
      Returns:
      the result of lowerCode
    • upperCode

      public static <X> Parser<X> upperCode(Function<String,X> factory)
      Performs upperCode.
      Parameters:
      factory - the factory value
      Returns:
      the result of upperCode
    • numericCode

      public static <X> Parser<X> numericCode(Function<String,X> factory)
      Performs numericCode.
      Parameters:
      factory - the factory value
      Returns:
      the result of numericCode
    • parse

      public final T parse(String text)
      Parses the provided value.
      Parameters:
      text - the text value
      Returns:
      the result of parse
    • tryParse

      public final Maybe<T> tryParse(String text)
      Performs tryParse.
      Parameters:
      text - the text value
      Returns:
      the result of tryParse
    • matchesExpectedPattern

      protected boolean matchesExpectedPattern(String text)
      Checks whether matches Expected Pattern.
      Parameters:
      text - the text value
      Returns:
      the result of matchesExpectedPattern
    • containsIllegalChars

      protected boolean containsIllegalChars(String text)
      Checks whether contains Illegal Chars.
      Parameters:
      text - the text value
      Returns:
      the result of containsIllegalChars
    • removeIllegalChars

      protected abstract String removeIllegalChars(String text)
      Performs remove Illegal Chars.
      Parameters:
      text - the text value
      Returns:
      the result of removeIllegalChars
    • wrap

      protected abstract T wrap(String text)
      Performs wrap.
      Parameters:
      text - the text value
      Returns:
      the result of wrap