bibliothek.gui.dock.util.property
Class ConstantPropertyFactory<A>

java.lang.Object
  extended by bibliothek.gui.dock.util.property.ConstantPropertyFactory<A>
Type Parameters:
A - the kind of value this factory handles
All Implemented Interfaces:
PropertyFactory<A>

public class ConstantPropertyFactory<A>
extends Object
implements PropertyFactory<A>

A PropertyFactory that always returns the same value.

Author:
Benjamin Sigg

Constructor Summary
ConstantPropertyFactory(A value)
          Creates a new factory.
 
Method Summary
 A getDefault(PropertyKey<A> key)
          Asks for the default value that should be used if no DockProperties are available.
 A getDefault(PropertyKey<A> key, DockProperties properties)
          Gets the default value for key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstantPropertyFactory

public ConstantPropertyFactory(A value)
Creates a new factory.

Parameters:
value - the value this factory returns, can be null
Method Detail

getDefault

public A getDefault(PropertyKey<A> key,
                    DockProperties properties)
Description copied from interface: PropertyFactory
Gets the default value for key. This method is called only once for the combination of key and properties, it can either always return the same object or create a new one every time. The results gets stored as default value in properties.

Specified by:
getDefault in interface PropertyFactory<A>
Parameters:
key - the key for which to get the default
properties - the map in which the default will be stored
Returns:
the new default value, null is valid

getDefault

public A getDefault(PropertyKey<A> key)
Description copied from interface: PropertyFactory
Asks for the default value that should be used if no DockProperties are available.

Specified by:
getDefault in interface PropertyFactory<A>
Parameters:
key - the key of the property
Returns:
the default value, can be null