bibliothek.extension.gui.dock.preference
Interface PreferenceFactory<V>

Type Parameters:
V - the kind of preference this factory stores

public interface PreferenceFactory<V>

A factory that is capable of writing and reading some kind of preference to or from some repository. PreferenceFactories are used by the PreferenceStorage.

Author:
Benjamin Sigg

Field Summary
static PreferenceFactory<java.lang.Boolean> FACTORY_BOOLEAN
          a factory for handling Boolean
static PreferenceFactory<java.lang.Integer> FACTORY_INT
          a factory for handling Integer
static PreferenceFactory<javax.swing.KeyStroke> FACTORY_KEYSTROKE
          a factory for handling KeyStroke
static PreferenceFactory<ModifierMask> FACTORY_MODIFIER_MASK
          a factory for ModifierMasks
static PreferenceFactory<java.lang.String> FACTORY_STRING
          A factory for handling String
 
Method Summary
 V read(java.io.DataInputStream in)
          Reads a value from in.
 V readXML(XElement element)
          Reads some value from element.
 void write(V value, java.io.DataOutputStream out)
          Writes value into out.
 void writeXML(V value, XElement element)
          Writes value into element.
 

Field Detail

FACTORY_BOOLEAN

static final PreferenceFactory<java.lang.Boolean> FACTORY_BOOLEAN
a factory for handling Boolean


FACTORY_INT

static final PreferenceFactory<java.lang.Integer> FACTORY_INT
a factory for handling Integer


FACTORY_STRING

static final PreferenceFactory<java.lang.String> FACTORY_STRING
A factory for handling String


FACTORY_KEYSTROKE

static final PreferenceFactory<javax.swing.KeyStroke> FACTORY_KEYSTROKE
a factory for handling KeyStroke


FACTORY_MODIFIER_MASK

static final PreferenceFactory<ModifierMask> FACTORY_MODIFIER_MASK
a factory for ModifierMasks

Method Detail

write

void write(V value,
           java.io.DataOutputStream out)
           throws java.io.IOException
Writes value into out.

Parameters:
value - the value to write, never null
out - the stream to write into
Throws:
java.io.IOException - if this factory can't write into out

writeXML

void writeXML(V value,
              XElement element)
Writes value into element. This method may add children and attributes to element. The attribute "type" shall not be changed by this method.

Parameters:
value - some value, not null
element - to write into, the attribute "type" shall not be changed by this method
Throws:
XException - if the value can't be transformed

read

V read(java.io.DataInputStream in)
       throws java.io.IOException
Reads a value from in. This method must read the same number of bytes as write(Object, DataOutputStream) had written.

Parameters:
in - the stream to read from
Returns:
the value that was read
Throws:
java.io.IOException - if in is not readable or the data is corrupted

readXML

V readXML(XElement element)
Reads some value from element.

Parameters:
element - the element to read from
Returns:
the value that was read
Throws:
XException - if element is not valid