Package gnu.dtools.ritopt
Class ShortOption
java.lang.Object
gnu.dtools.ritopt.Option
gnu.dtools.ritopt.ShortOption
- All Implemented Interfaces:
OptionModifiable
This class is used for options with short values.
Copyright (C) Damian Ryan Eads, 2001. All Rights Reserved. ritopt is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. ritopt is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with ritopt; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
Field Summary
Fields inherited from class gnu.dtools.ritopt.Option
DEFAULT_FILE_COMMENT_SIZE, DEFAULT_FILE_COMPLETE_OPTION_SIZE, DEFAULT_HELP_DEPRECATED_SIZE, DEFAULT_HELP_DESCRIPTION_SIZE, DEFAULT_HELP_OPTION_SIZE, DEFAULT_HELP_TYPENAME_SIZE, DEFAULT_MENU_DEPRECATED_SIZE, DEFAULT_MENU_DESCRIPTION_SIZE, DEFAULT_MENU_OPTION_SIZE, DEFAULT_MENU_TYPENAME_SIZE, invoked -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a short option that is initially set to zero.ShortOption(short value) Constructs a short option initialized with the value passed.ShortOption(short value, char shortOption) Constructs a character option initialized with the value and short option passed.ShortOption(short value, String longOption) Constructs a short option initialized with the value and long option passed.ShortOption(short value, String longOption, char shortOption) Constructs a short option initialized with the value, short and long option passed.Constructs a short option by copying the short option passed. -
Method Summary
Modifier and TypeMethodDescriptionReturn the value as an object.Return this option as a string.Returns the type name of this option.shortgetValue()Return this option as a short.voidModify this option based on a string representation.voidsetValue(short value) Modify this option using a short value.voidModify this option based on a string representation.toString()Returns a string representation of this object.Methods inherited from class gnu.dtools.ritopt.Option
action, deprecate, getDescription, getFileCommentSize, getFileCompleteOptionSize, getHashKey, getHashKey, getHashKey, getHashKey, getHelp, getHelpDeprecated, getHelpDeprecatedSize, getHelpDescription, getHelpDescriptionSize, getHelpHeader, getHelpOptionSpecification, getHelpOptionSpecificationSize, getHelpTypeName, getHelpTypenameSize, getLongOption, getMenuDeprecatedSize, getMenuDescriptionSize, getMenuOptionSpecificationSize, getMenuTypenameSize, getName, getOptionFileLine, getShortOption, isDeprecated, isInvoked, setDeprecated, setDescription, setFileCommentSize, setFileCompleteOptionSize, setHelpDeprecatedSize, setHelpDescriptionSize, setHelpOptionSpecificationSize, setHelpTypenameSize, setInvoked, setKey, setKey, setLongOption, setMenuDeprecatedSize, setMenuDescriptionSize, setMenuOptionSpecificationSize, setMenuTypenameSize, setShortOption
-
Constructor Details
-
ShortOption
public ShortOption()Constructs a short option that is initially set to zero. -
ShortOption
Constructs a short option by copying the short option passed.- Parameters:
op- The character option to copy.
-
ShortOption
public ShortOption(short value) Constructs a short option initialized with the value passed.- Parameters:
value- The initial value of this short option.
-
ShortOption
Constructs a short option initialized with the value and long option passed.- Parameters:
value- The initial value of this short option.longOption- The long option associated with short option.
-
ShortOption
public ShortOption(short value, char shortOption) Constructs a character option initialized with the value and short option passed.- Parameters:
value- The initial value of this short option.shortOption- The short option associated with this option.
-
ShortOption
Constructs a short option initialized with the value, short and long option passed.- Parameters:
shortOption- The short option associated with this option.longOption- The long option associated with this option.value- The initial value of this short option.
-
-
Method Details
-
getObject
Return the value as an object. -
modify
Modify this option based on a string representation.- Parameters:
value- String representation of the object.- Throws:
OptionModificationException- Thrown if an error occurs during modification of an option.
-
setValue
Modify this option based on a string representation.- Parameters:
value- String representation of the object.- Throws:
OptionModificationException- Thrown if an error occurs during modification of an option.
-
setValue
public void setValue(short value) Modify this option using a short value.- Parameters:
value- A short value.
-
getValue
public short getValue()Return this option as a short.- Returns:
- This option as a short.
-
getStringValue
Return this option as a string.- Specified by:
getStringValuein classOption- Returns:
- This option as a string.
-
getTypeName
Returns the type name of this option. For a ShortOption, "SHORT" is returned.- Specified by:
getTypeNamein classOption- Returns:
- The type name of this option.
-
toString
Returns a string representation of this object.
-