Class ByteOption

java.lang.Object
gnu.dtools.ritopt.Option
gnu.dtools.ritopt.ByteOption
All Implemented Interfaces:
OptionModifiable

public class ByteOption extends Option
This class is used for options with byte 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
 
  • Constructor Details

    • ByteOption

      public ByteOption()
      Constructs a byte option that is set to the null character.
    • ByteOption

      public ByteOption(ByteOption op)
      Constructs a byte option by copying the byte option passed.
      Parameters:
      op - The byte option to copy.
    • ByteOption

      public ByteOption(byte value)
      Constructs a byte option initialized with the value passed.
      Parameters:
      value - The initial value of this byte option.
    • ByteOption

      public ByteOption(byte value, String longOption)
      Constructs a byte option initialized with the value and long option passed.
      Parameters:
      value - The initial value of this byte option.
      longOption - The long option associated with this option.
    • ByteOption

      public ByteOption(byte value, char shortOption)
      Constructs a byte option initialized with the value and short option passed.
      Parameters:
      shortOption - The short option associated with this option.
      value - The initial value of this byte option.
    • ByteOption

      public ByteOption(byte value, String longOption, char shortOption)
      Constructs a byte 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 byte option.
  • Method Details

    • getObject

      public Object getObject()
      Return the value as an object.
      Specified by:
      getObject in class Option
      Returns:
      This value as an option.
    • modify

      public void modify(String value) throws OptionModificationException
      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(String value) throws OptionModificationException
      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(byte value)
      Modify this option using a byte value.
      Parameters:
      value - A byte value.
    • getValue

      public byte getValue()
      Return this option as a boolean.
      Returns:
      This option as a boolean.
    • getStringValue

      public String getStringValue()
      Return this option as a string.
      Specified by:
      getStringValue in class Option
      Returns:
      This option as a string.
    • getTypeName

      public String getTypeName()
      Returns the type name of this option. For a ByteOption, "BYTE" is returned.
      Specified by:
      getTypeName in class Option
      Returns:
      The type name of this option.
    • toString

      public String toString()
      Returns a string representation of this object.
      Overrides:
      toString in class Object
      Returns:
      A string representation of this object.