wt.prefs
Class PreferenceMapping

java.lang.Object
  extended bywt.prefs.PreferenceMapping

public class PreferenceMapping
extends Object

This class is used as a data storage structure for Preference Mappings. The Preference Mappings are stored in a Tree structure for quicker searching. Each node of the tree is indexed by the Preference Key (full qualified) with a HashMap for each key containing the Preference Heirarchial level and the appropriate Preference Entry type to be used for invoking. This class should only be used by the PrefEntrySelector

Supported API: false

Extendable: false


Field Summary
static String ALL_CONTEXTS
          Constant for all contexts
private static boolean debug
          Boolean for debug statements
private  TreeMap keyMap
          The map of keys in the mapping
private  Vector types
           
 
Constructor Summary
PreferenceMapping()
           
 
Method Summary
 void add(String key, String context, Class type)
          This method will add a key and context with a Class Pref Entry to the Preference Mapping.
 void clear()
          Will clear all Preference Mappings from the Tree.
 Class findMap(String key, String context)
          Given a key and a context, this method will attempt to find the Preference entry in the mapping file.
 Vector getAllTypes()
          This method will copy all of the types that are contained in the mapping and return the array of classes.
 int getSize()
          Return the number of items in the Preference Mapping

 String toString()
          This method will output the contents of the Preference Mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

keyMap

private TreeMap keyMap
The map of keys in the mapping


types

private Vector types

debug

private static boolean debug
Boolean for debug statements


ALL_CONTEXTS

public static final String ALL_CONTEXTS
Constant for all contexts

See Also:
Constant Field Values
Constructor Detail

PreferenceMapping

public PreferenceMapping()
Method Detail

getSize

public int getSize()
Return the number of items in the Preference Mapping

Returns:
int The size of the Preference Mapping

clear

public void clear()
Will clear all Preference Mappings from the Tree.


findMap

public Class findMap(String key,
                     String context)
Given a key and a context, this method will attempt to find the Preference entry in the mapping file. If successful, the Class which is to be used for the preference mapping is returned.

Supported API: false

Parameters:
key - The key to use to map.
context - The context of the Preference key
Returns:
Class The PrefEntry class which will map the entry.

add

public void add(String key,
                String context,
                Class type)
This method will add a key and context with a Class Pref Entry to the Preference Mapping. The value is appended to the end of the list.

Parameters:
key - The key to map.
context - The context for the key to map
type - The type to map to.

getAllTypes

public Vector getAllTypes()
This method will copy all of the types that are contained in the mapping and return the array of classes.


toString

public String toString()
This method will output the contents of the Preference Mapping. The format will be:





Supported API: false

Returns:
String The string list of contents