Documentation of 'gnu.getopt.LongOpt' Java class
LongOpt
gnu.getopt

Class LongOpt



  • public class LongOpt
    extends java.lang.Object
    This object represents the definition of a long option in the Java port of GNU getopt. An array of LongOpt objects is passed to the Getopt object to define the list of valid long options for a given parsing session. Refer to the getopt documentation for details on the format of long options.
    See Also:
    Getopt
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int NO_ARGUMENT
      Constant value used for the "has_arg" constructor argument.
      static int OPTIONAL_ARGUMENT
      Constant value used for the "has_arg" constructor argument.
      static int REQUIRED_ARGUMENT
      Constant value used for the "has_arg" constructor argument.
    • Constructor Summary

      Constructors 
      Constructor and Description
      LongOpt(java.lang.String name, int has_arg, java.lang.StringBuffer flag, int val)
      Create a new LongOpt object with the given parameter values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.StringBuffer getFlag()
      Returns the value of the 'flag' field for this long option
      int getHasArg()
      Returns the value set for the 'has_arg' field for this long option
      java.lang.String getName()
      Returns the name of this LongOpt as a String
      int getVal()
      Returns the value of the 'val' field for this long option
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NO_ARGUMENT

        public static final int NO_ARGUMENT
        Constant value used for the "has_arg" constructor argument. This value indicates that the option takes no argument.
        See Also:
        Constant Field Values
      • REQUIRED_ARGUMENT

        public static final int REQUIRED_ARGUMENT
        Constant value used for the "has_arg" constructor argument. This value indicates that the option takes an argument that is required.
        See Also:
        Constant Field Values
      • OPTIONAL_ARGUMENT

        public static final int OPTIONAL_ARGUMENT
        Constant value used for the "has_arg" constructor argument. This value indicates that the option takes an argument that is optional.
        See Also:
        Constant Field Values
    • Constructor Detail

      • LongOpt

        public LongOpt(java.lang.String name,
                       int has_arg,
                       java.lang.StringBuffer flag,
                       int val)
                throws java.lang.IllegalArgumentException
        Create a new LongOpt object with the given parameter values. If the value passed as has_arg is not valid, then an exception is thrown.
        Parameters:
        name - The long option String.
        has_arg - Indicates whether the option has no argument (NO_ARGUMENT), a required argument (REQUIRED_ARGUMENT) or an optional argument (OPTIONAL_ARGUMENT).
        flag - If non-null, this is a location to store the value of "val" when this option is encountered, otherwise "val" is treated as the equivalent short option character.
        val - The value to return for this long option, or the equivalent single letter option to emulate if flag is null.
        Throws:
        java.lang.IllegalArgumentException - If the has_arg param is not one of NO_ARGUMENT, REQUIRED_ARGUMENT or OPTIONAL_ARGUMENT.
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns the name of this LongOpt as a String
        Returns:
        Then name of the long option
      • getHasArg

        public int getHasArg()
        Returns the value set for the 'has_arg' field for this long option
        Returns:
        The value of 'has_arg'
      • getFlag

        public java.lang.StringBuffer getFlag()
        Returns the value of the 'flag' field for this long option
        Returns:
        The value of 'flag'
      • getVal

        public int getVal()
        Returns the value of the 'val' field for this long option
        Returns:
        The value of 'val'

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.