Package com.martiansoftware.jsap

Examples of com.martiansoftware.jsap.ParseException


     * @see com.martiansoftware.jsap.StringParser#parse(String)
     */
    public Object parse(String arg) throws ParseException {
        if ((arg == null) || (arg.length() != 1)) {
            throw (
                new ParseException(
                    "Unable to convert '" + arg + "' to a Character."));
        }
        return (new Character(arg.charAt(0)));
    }
View Full Code Here


        Double result = null;
        try {
            result = new Double(arg);
        } catch (NumberFormatException e) {
            throw (
                new ParseException(
                    "Unable to convert '" + arg + "' to a Double.",
                    e));
        }
        return (result);
    }
View Full Code Here

    File result = null;
    try {
      result = new File(arg);

            if (mustExist() && !result.exists()) {
                throw (new ParseException(result + " does not exist."));
            }
      if (mustBeDirectory() && result.exists() && !result.isDirectory()) {
        throw (new ParseException(result + " is not a directory."));
      }
      if (mustBeFile() && result.exists() && result.isDirectory()) {
        throw (new ParseException(result + " is not a file."));
      }
    } catch (NullPointerException e) {
      throw (
        new ParseException(
          "No File given to parse",
          e));
    }
    return (result);
  }
View Full Code Here

     */
    public Object parse(String arg) throws ParseException {
        Package result = Package.getPackage(arg);
        if (result == null) {
            throw (
                new ParseException("Unable to locate Package '" + arg + "'."));
        }
        return (result);
    }
View Full Code Here

                || arg.equalsIgnoreCase("no")
                || arg.equals("0")) {
            result = false;
        } else {
            throw (
                new ParseException(
                    "Unable to convert '" + arg + "' to a boolean value."));
        }
        return (new Boolean(result));
    }
View Full Code Here

TOP

Related Classes of com.martiansoftware.jsap.ParseException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.