Examples of ArgumentParserException


Examples of net.sourceforge.argparse4j.inf.ArgumentParserException

    public Object convert(ArgumentParserImpl parser, String value)
            throws ArgumentParserException {
        Object obj = type_.convert(parser, this, value);
        if (choice_ != null && !choice_.contains(obj)) {
            throw new ArgumentParserException(String.format(
                    TextHelper.LOCALE_ROOT,
                    "invalid choice: '%s' (choose from %s)", value,
                    choice_.textualFormat()), parser, this);
        }
        return obj;
View Full Code Here

Examples of net.sourceforge.argparse4j.inf.ArgumentParserException

    }

    private void verifyExists(ArgumentParser parser, Argument arg, File file)
            throws ArgumentParserException {
        if (!file.exists()) {
            throw new ArgumentParserException(String.format(
                    TextHelper.LOCALE_ROOT, "File not found: '%s'", file),
                    parser, arg);
        }
    }
View Full Code Here

Examples of net.sourceforge.argparse4j.inf.ArgumentParserException

    }

    private void verifyNotExists(ArgumentParser parser, Argument arg, File file)
            throws ArgumentParserException {
        if (file.exists()) {
            throw new ArgumentParserException(String.format(
                    TextHelper.LOCALE_ROOT, "File found: '%s'", file), parser,
                    arg);
        }
    }
View Full Code Here

Examples of net.sourceforge.argparse4j.inf.ArgumentParserException

    }

    private void verifyIsFile(ArgumentParser parser, Argument arg, File file)
            throws ArgumentParserException {
        if (!file.isFile()) {
            throw new ArgumentParserException(String.format(
                    TextHelper.LOCALE_ROOT, "Not a file: '%s'", file), parser,
                    arg);
        }
    }
View Full Code Here

Examples of net.sourceforge.argparse4j.inf.ArgumentParserException

    }

    private void verifyIsDirectory(ArgumentParser parser, Argument arg,
            File file) throws ArgumentParserException {
        if (!file.isDirectory()) {
            throw new ArgumentParserException(String.format(
                    TextHelper.LOCALE_ROOT, "Not a directory: '%s'", file),
                    parser, arg);
        }
    }
View Full Code Here

Examples of net.sourceforge.argparse4j.inf.ArgumentParserException

    }

    private void verifyCanRead(ArgumentParser parser, Argument arg, File file)
            throws ArgumentParserException {
        if (!file.canRead()) {
            throw new ArgumentParserException(String.format(
                    TextHelper.LOCALE_ROOT,
                    "Insufficient permissions to read file: '%s'", file),
                    parser, arg);
        }
    }
View Full Code Here

Examples of net.sourceforge.argparse4j.inf.ArgumentParserException

    }

    private void verifyCanWrite(ArgumentParser parser, Argument arg, File file)
            throws ArgumentParserException {
        if (!file.canWrite()) {
            throw new ArgumentParserException(String.format(
                    TextHelper.LOCALE_ROOT,
                    "Insufficient permissions to write file: '%s'", file),
                    parser, arg);
        }
    }
View Full Code Here

Examples of net.sourceforge.argparse4j.inf.ArgumentParserException

    private void verifyCanWriteParent(ArgumentParser parser, Argument arg,
            File file) throws ArgumentParserException {
        File parent = file.getParentFile();
        if (parent == null || !parent.canWrite()) {
            throw new ArgumentParserException(String.format(
                    TextHelper.LOCALE_ROOT,
                    "Cannot write parent of file: '%s'", file), parser, arg);
        }
    }
View Full Code Here

Examples of net.sourceforge.argparse4j.inf.ArgumentParserException

            }
        } catch (IOException e) {
        }

        // An exception was thrown or the parent directory can't be written
        throw new ArgumentParserException(String.format(TextHelper.LOCALE_ROOT,
                "Cannot create file: '%s'", file), parser, arg);

    }
View Full Code Here

Examples of net.sourceforge.argparse4j.inf.ArgumentParserException

    }

    private void verifyCanExecute(ArgumentParser parser, Argument arg, File file)
            throws ArgumentParserException {
        if (!file.canExecute()) {
            throw new ArgumentParserException(String.format(
                    TextHelper.LOCALE_ROOT,
                    "Insufficient permissions to execute file: '%s'", file),
                    parser, arg);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.