Class LongStringParser

java.lang.Object
com.martiansoftware.jsap.StringParser
com.martiansoftware.jsap.stringparsers.LongStringParser

public class LongStringParser extends StringParser
A StringParser for parsing Longs. The parse() method delegates the actual parsing to Long.decode(String).
Author:
Marty Lamb
See Also:
  • Constructor Details

    • LongStringParser

      public LongStringParser()
      Deprecated.
      Use getParser() or, even better, JSAP.LONG_PARSER.
      Creates a new LongStringParser.
  • Method Details

    • getParser

      public static LongStringParser getParser()
      Returns a LongStringParser.

      Convenient access to the only instance returned by this method is available through JSAP.LONG_PARSER.

      Returns:
      a LongStringParser.
    • parse

      public Object parse(String arg) throws ParseException
      Parses the specified argument into a Long. This method delegates the parsing to Long.decode(arg). If Long.decode() throws a NumberFormatException, it is encapsulated into a ParseException and re-thrown.
      Specified by:
      parse in class StringParser
      Parameters:
      arg - the argument to parse
      Returns:
      a Long object with the value contained in the specified argument.
      Throws:
      ParseException - if Long.decode(arg) throws a NumberFormatException.
      See Also: