1 /** 2 * Copyright (C) 2010 the original author or authors. 3 * See the notice.md file distributed with this work for additional 4 * information regarding copyright ownership. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package com.beust.jcommander; 20 21 /** 22 * The main exception that JCommand will throw when something goes wrong while 23 * parsing parameters. 24 * 25 * @author Cedric Beust <cedric@beust.com> 26 */ 27 @SuppressWarnings("serial") 28 public class ParameterException extends RuntimeException { ParameterException(Throwable t)29 public ParameterException(Throwable t) { 30 super(t); 31 } 32 ParameterException(String string)33 public ParameterException(String string) { 34 super(string); 35 } 36 ParameterException(String string, Throwable t)37 public ParameterException(String string, Throwable t) { 38 super(string, t); 39 } 40 41 private JCommander jc; 42 setJCommander(JCommander jc)43 public void setJCommander(JCommander jc) { 44 this.jc = jc; 45 } 46 getJCommander()47 public JCommander getJCommander() { 48 return jc; 49 } 50 usage()51 public void usage() { 52 if (jc != null) { 53 jc.usage(); 54 } 55 } 56 } 57