Class StringParser

    • Constructor Summary

      Constructors 
      Constructor Description
      StringParser()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract java.lang.Object parse​(java.lang.String arg)
      Parses the specified argument into an Object of the appropriate type.
      void setUp()
      Performs any initialization not handled by this StringParser's constructor.
      void tearDown()
      Performs any cleanup necessary for this StringParser.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringParser

        public StringParser()
    • Method Detail

      • setUp

        public void setUp()
                   throws java.lang.Exception
        Performs any initialization not handled by this StringParser's constructor. The contract for this method is that it will be called AT LEAST once before this object's parse() method is called.

        In the JSAP API, this method is called every time an Option containing this StringParser is registered with a JSAP. If there is an initialization error, this method should throw a JSAPException to prevent the Option from being registered.
        Throws:
        java.lang.Exception - if an initialization error occurs that should prevent the Option containing this StringParser from being registered.
      • tearDown

        public void tearDown()
        Performs any cleanup necessary for this StringParser. The contract for this method is that it MAY be called at any time after the setUp method has been called. It may be called more than once.

        In the JSAP API, this method is called every time an Option containing this StringParser is unregistered from a JSAP. During finalization, any registered Options are unregistered from a JSAP.
      • parse

        public abstract java.lang.Object parse​(java.lang.String arg)
                                        throws ParseException
        Parses the specified argument into an Object of the appropriate type. If the specified argument cannot be converted into the desired Object, a ParseException should be thrown.

        Note: this method MAY BE CALLED with a null argument. Take this into consideration when subclassing!
        Parameters:
        arg - the argument to convert to an Object of class appropriate to the StringParser subclass.
        Returns:
        the Object resulting from the parsed argument.
        Throws:
        ParseException - if the specified argument cannot be parsed.