exceptions.UsageException.java Source code

Java tutorial

Introduction

Here is the source code for exceptions.UsageException.java

Source

/**
 * This file is a component of jiminix
 *
 * Copyright (c) 2013 Jason Campos <jcampos8782@gmail.com>
 * All Rights Reserved.
 *
 * This software is licensed under The MIT License (MIT)
 * http://opensource.org/licenses/MIT
 */
package exceptions;

import java.util.concurrent.ExecutionException;

import org.apache.commons.cli.Options;

/**
 * A throwable exception which specifies the proper usage of a command.
 * 
 * @author Jason Campos <jcampos8782@gmail.com>
 */
public class UsageException extends ExecutionException {
    private static final long serialVersionUID = 1L;

    private String message;

    @SuppressWarnings("unused") // TODO: Use these in message
    private Options options;

    public UsageException(String message) {
        this(message, null);
    }

    public UsageException(String message, Options options) {
        super(message);
        this.message = "Usage: " + message;
        this.options = options;
    }

    @Override
    public String getMessage() {
        return message;
    }
}