ClassStringParser (JSAP: the Java Simple Argument Parser)
Keywords: com.martiansoftware.jsap.stringparsers.ClassStringParser class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.martiansoftware.jsap.stringparsers
Class ClassStringParser

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

    public class ClassStringParser

extends StringParser

A `StringParser` for parsing Class objects. The parse(arg) method calls Class.forName(arg) and returns the result. If any exceptions are thrown by Class.forName(), they are encapsulated in a ParseException and re-thrown.

Note: The Class.forName() call attempts to load the class from the same ClassLoader that loaded this StringParser.

Author:
  Marty Lamb
See Also:
  `StringParser`, `Class`

Constructor Summary
`ClassStringParser()` Deprecated. Use `getParser()` or, even better, `JSAP.CLASS_PARSER`.

Method Summary
`static ClassStringParser` | `getParser()` Returns a `ClassStringParser`.
`Object` | `parse(String arg)` Parses the specified argument into a Class object.

Methods inherited from class com.martiansoftware.jsap.StringParser
`setUp, tearDown`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ClassStringParser

    public ClassStringParser()

  Deprecated. Use `getParser()` or, even better, `JSAP.CLASS_PARSER`.

  Creates a new ClassStringParser.

Method Detail

### getParser

    public static ClassStringParser getParser()

  Returns a `ClassStringParser`.

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

  Returns:
    a `ClassStringParser`.

### parse

    public Object parse(String arg)
                 throws ParseException

  Parses the specified argument into a Class object. This method calls Class.forName(), passing the specified argument as the name of the class to load, and returns the resulting Class object. If an exception is thrown by Class.forName(), it is encapsulated in a ParseException and re-thrown.

  Specified by:
    `parse` in class `StringParser`
  Parameters:
    `arg` - the argument to parse
  Returns:
    a Class object representing the class named by the specified argument.
  Throws:
    `ParseException` - if `Class.forName(arg)` throws an exception.
  See Also:
    `Class`, `StringParser.parse(String)`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2005, Martian Software, Inc.. All Rights Reserved.
For the latest version and documentation, please visit http://www.martiansoftware.com/jsap