Class ForNameStringParser


  • public class ForNameStringParser
    extends StringParser
    A StringParser that passes the argument to a static method of signature forName(String) of a specified class.

    Note that, for instance, this parser can be used with Class (resulting in a string parser identical to ClassStringParser), but also Charset, and more generally, any class using the forName(String) convention.

    Author:
    Sebastiano Vigna
    • Method Detail

      • parse

        public Object parse​(String arg)
                     throws ParseException
        Description copied from class: StringParser
        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!
        Specified by:
        parse in class StringParser
        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.