Class Option<V>


  • public final class Option<V>
    extends java.lang.Object
    Represents a configuration option. A configuration option is used as a key to get and set values from a Options structure. In addition, an option has a predefined default value.
    Since:
    2.0
    Version:
    2.0
    Author:
    Evren Sirin
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Option​(java.lang.String name, V defaultValue)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> Option<T> create​(java.lang.String name)
      Creates an option with the given name and null default value.
      static <T> Option<T> create​(java.lang.String name, T defaultValue)
      Creates an option with the given name and default value.
      boolean equals​(java.lang.Object other)  
      V getDefaultValue()
      Returns the default value for this option.
      java.lang.String getName()  
      int hashCode()  
      void setDefaultValue​(V defaultValue)
      Sets the default value for this option.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Option

        protected Option​(java.lang.String name,
                         V defaultValue)
    • Method Detail

      • create

        public static <T> Option<T> create​(java.lang.String name)
        Creates an option with the given name and null default value.
      • create

        public static <T> Option<T> create​(java.lang.String name,
                                           T defaultValue)
        Creates an option with the given name and default value.
      • getDefaultValue

        public V getDefaultValue()
        Returns the default value for this option.
      • setDefaultValue

        public void setDefaultValue​(V defaultValue)
        Sets the default value for this option. This will have a global effect.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getName

        public java.lang.String getName()