1 /* 2 Option.java 3 Creation date : 2/06/2010 4 Copyright © Benjamin Croizet (graffity2199@yahoo.fr) 5 6 This program is free software; you can redistribute it and/or 7 modify it under the terms of the GNU General Public License 8 or GNU Lesser General Public License as published by the 9 Free Software Foundation; either version 3 of the License, 10 or (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received copies of the GNU General Public License 18 and GNU Lesser General Public License along with this program; 19 if not, write to the Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 http://www.fsf.org/licensing/licenses/gpl.html 22 http://www.gnu.org/licenses/lgpl.html 23 */ 24 25 package net.sourceforge.plantumldependency.commoncli.option; 26 27 import java.io.Serializable; 28 import java.util.Set; 29 30 import net.sourceforge.plantumldependency.common.clone.DeepCloneable; 31 import net.sourceforge.plantumldependency.commoncli.option.status.OptionStatus; 32 33 /** 34 * The interface which describes a command line option. 35 * 36 * @author Benjamin Croizet (<a href="mailto:graffity2199@yahoo.fr>graffity2199@yahoo.fr</a>) 37 * @since 1.3.0 38 * @version 1.3.0 39 */ 40 public interface Option extends Comparable < Option >, Serializable, DeepCloneable < Option > { 41 42 /** 43 * Gets all option names, i.e. the main name and all secondary option names. 44 * 45 * @return the {@link Set} of option names. Can't be empty. 46 * @since 1.3.0 47 */ 48 Set < String > getAllNames(); 49 50 /** 51 * Gets the full option usage, i.e. the full synopsis of how the option is used, with all 52 * secondary names and the full option's description. 53 * <p> 54 * For instance it can be :<br> 55 * "<i>-about, --author, --authors<br> 56 * To display information about the program and its authors."</i> 57 * </p> 58 * 59 * @return the main option usage as a {@link StringBuilder}. 60 * @since 1.3.0 61 */ 62 StringBuilder getFullUsage(); 63 64 /** 65 * Gets the main option usage, i.e. the summary synopsis of how the option is used with only its 66 * main name. 67 * <p> 68 * For instance it can be :<br> 69 * "<i>-output FILE</i>". 70 * </p> 71 * 72 * @return the main option usage as a {@link StringBuilder}. 73 * @since 1.3.0 74 */ 75 StringBuilder getMainUsage(); 76 77 /** 78 * Gets the main option name, such as "-v", "-o", or "-version". 79 * 80 * @return the main option name as a {@link String}. 81 * @since 1.3.0 82 */ 83 String getName(); 84 85 /** 86 * Gets all secondary option names, which may be used as synonyms, such as "--verbose" or 87 * "--author". 88 * 89 * @return the {@link Set} of option secondary names. May be empty. 90 * @since 1.3.0 91 */ 92 Set < String > getSecondaryNames(); 93 94 /** 95 * Gets the option status, telling if the option is active, inactive or hidden. 96 * 97 * @return the {@link OptionStatus} instance. 98 * @since 1.3.0 99 */ 100 OptionStatus getStatus(); 101 102 /** 103 * Gets the boolean which tells if the option is mandatory. 104 * 105 * @return <code>true</code> if the option is mandatory, <code>false</code> otherwise. 106 * @since 1.3.0 107 */ 108 boolean isMandatory(); 109 }