bibliothek.gui.dock.util
Class NullPriorityValue<T>

java.lang.Object
  extended by bibliothek.gui.dock.util.NullPriorityValue<T>
Type Parameters:
T - the kind of value stored in this NullPriorityValue

public class NullPriorityValue<T>
extends Object

This container holds three versions of the same value, a default, theme and a client value. If asked for the value the value with the highest priority is returned. Other than PriorityValue this container also supports null as value.

Author:
Benjamin Sigg

Constructor Summary
NullPriorityValue()
           
 
Method Summary
 T get()
          Gets the current value with the highest priority.
 T get(Priority priority)
          Gets the value for a given priority.
 boolean isSet(Priority priority)
          Tells whether the value for priority is set.
 boolean isSomethingSet()
          Tells whether at least one version is set.
 boolean set(Priority priority, T value)
          Sets the value for a given priority.
 boolean unset(Priority priority)
          Removes the value for priority.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullPriorityValue

public NullPriorityValue()
Method Detail

set

public boolean set(Priority priority,
                   T value)
Sets the value for a given priority.

Parameters:
priority - the priority of value
value - the new value, can be null
Returns:
true if the result of get() changes because of the call of this method

isSomethingSet

public boolean isSomethingSet()
Tells whether at least one version is set.

Returns:
true if at least some value is set

isSet

public boolean isSet(Priority priority)
Tells whether the value for priority is set.

Parameters:
priority - the priority to inquire
Returns:
true if the value is set

unset

public boolean unset(Priority priority)
Removes the value for priority.

Parameters:
priority - the priority to clean
Returns:
true if the result of get() changes because of the call to this method

get

public T get(Priority priority)
Gets the value for a given priority.

Parameters:
priority - the priority for which the value is requested
Returns:
the value that was set(Priority, Object) for priority

get

public T get()
Gets the current value with the highest priority.

Returns:
the value or null