Class Parameters


  • public class Parameters
    extends java.lang.Object
    Parameters passed to a main method (also known as "command-line arguments"). Arguments are recognized only if they are of the form -key or -key:value
    Version:
    1.7
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Parameters()
      Creates a Parameters object for the given main-method arguments.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(java.lang.String key)
      Returns true if key is one of the parameters.
      java.lang.String get​(java.lang.String key)
      Returns the value of the specified parameter, or null if there is no such key.
      static Parameters getInstance()
      Returns the singleton.
      static void setParameters​(java.lang.String[] args, java.lang.String[] reqdKeys, java.lang.String[] optionalKeys)
      Sets the command-line arguments.
      • Methods inherited from class java.lang.Object

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

      • arguments

        private static java.util.List arguments
      • requiredKeys

        private static java.util.List requiredKeys
      • allowedKeys

        private static java.util.List allowedKeys
      • hashtable

        private java.util.Hashtable hashtable
    • Constructor Detail

      • Parameters

        private Parameters()
        Creates a Parameters object for the given main-method arguments.
    • Method Detail

      • setParameters

        public static void setParameters​(java.lang.String[] args,
                                         java.lang.String[] reqdKeys,
                                         java.lang.String[] optionalKeys)
        Sets the command-line arguments. reqdKeys may be set to null if there are no required command-line arguments. Same with optionalKeys.
      • getInstance

        public static Parameters getInstance()
        Returns the singleton. Be sure to call #setParameters first.
      • contains

        public boolean contains​(java.lang.String key)
        Returns true if key is one of the parameters. Case-insensitive.
      • get

        public java.lang.String get​(java.lang.String key)
        Returns the value of the specified parameter, or null if there is no such key. Case-insensitive.