Package gnu.dtools.ritopt
Class CharOption
- java.lang.Object
-
- gnu.dtools.ritopt.Option
-
- gnu.dtools.ritopt.CharOption
-
- All Implemented Interfaces:
OptionModifiable
public class CharOption extends Option
This class is used for options with character 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
Constructors Constructor Description CharOption()Constructs a character option that is set to the space character.CharOption(char value)Constructs a character option initialized with the value passed.CharOption(char value, char shortOption)Constructs a character option initialized with the value and short option passed.CharOption(char value, java.lang.String longOption)Constructs a character option initialized with the value and long option passed.CharOption(char value, java.lang.String longOption, char shortOption)Constructs a character option initialized with the value, short and long option passed.CharOption(CharOption op)Constructs a character option by copying the character option passed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectgetObject()Return the value as an object.java.lang.StringgetStringValue()Return this option as a string.java.lang.StringgetTypeName()Returns the type name of this option.chargetValue()Return this option as a character.voidmodify(java.lang.String value)Modify this option based on a string representation.voidsetValue(char value)Modify this option using a character value.voidsetValue(java.lang.String value)Modify this option based on a string representation.java.lang.StringtoString()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 Detail
-
CharOption
public CharOption()
Constructs a character option that is set to the space character.
-
CharOption
public CharOption(CharOption op)
Constructs a character option by copying the character option passed.- Parameters:
op- The character option to copy.
-
CharOption
public CharOption(char value)
Constructs a character option initialized with the value passed.- Parameters:
value- The initial value of this character option.
-
CharOption
public CharOption(char value, java.lang.String longOption)Constructs a character option initialized with the value and long option passed.- Parameters:
value- The initial value of this character option.longOption- The long option associated with character option.
-
CharOption
public CharOption(char value, char shortOption)Constructs a character option initialized with the value and short option passed.- Parameters:
value- The initial value of this character option.shortOption- The short option associated with this option.
-
CharOption
public CharOption(char value, java.lang.String longOption, char shortOption)Constructs a character 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 character option.
-
-
Method Detail
-
getObject
public java.lang.Object getObject()
Return the value as an object.
-
modify
public void modify(java.lang.String value) throws OptionModificationExceptionModify 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(java.lang.String value) throws OptionModificationExceptionModify 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(char value)
Modify this option using a character value.- Parameters:
value- A character value.
-
getValue
public char getValue()
Return this option as a character.- Returns:
- This option as a character.
-
getStringValue
public java.lang.String getStringValue()
Return this option as a string.- Specified by:
getStringValuein classOption- Returns:
- This option as a string.
-
getTypeName
public java.lang.String getTypeName()
Returns the type name of this option. For a ByteOption, "BYTE" is returned.- Specified by:
getTypeNamein classOption- Returns:
- The type name of this option.
-
toString
public java.lang.String toString()
Returns a string representation of this object.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of this object.
-
-