chrriis.dj.nativeswing
Class NSOption

java.lang.Object
  extended by chrriis.dj.nativeswing.NSOption

public class NSOption
extends Object

An option, which contains a key to identify a group of related options and the value of that option.

Author:
Christopher Deckers

Constructor Summary
NSOption(Object key)
          Create an option.
 
Method Summary
static Map<Object,Object> createOptionMap(NSOption... options)
          Create a map from option key to option value.
 Object getOptionKey()
          Get the key of this option.
 Object getOptionValue()
          Get the value of this option.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NSOption

public NSOption(Object key)
Create an option.

Parameters:
key - the key, or null for a default key to be created.
Method Detail

createOptionMap

public static Map<Object,Object> createOptionMap(NSOption... options)
Create a map from option key to option value. If a key is present several times, the latest value is retained.

Parameters:
options - the options for which to construct the map.

getOptionKey

public Object getOptionKey()
Get the key of this option.

Returns:
the key of this option.

getOptionValue

public Object getOptionValue()
Get the value of this option. The default is to return this object, assuming the instance is a singleton. This method should be overriden if a different value should be considered.

Returns:
the value of this option.

toString

public String toString()
Overrides:
toString in class Object