de.tkuhn.util.prefs
Class MetaInfoProvider

java.lang.Object
  extended by de.tkuhn.util.prefs.MetaInfoProvider
Direct Known Subclasses:
PrefsMetaInfoProvider

public abstract class MetaInfoProvider
extends java.lang.Object

This class describes Objects that can provide MetaInfo and Resources for given Preferences. It also implements singleton semantics for creating instances.

Author:
Tilmann Kuhn

Constructor Summary
MetaInfoProvider()
           
 
Method Summary
static MetaInfoProvider getInstance()
          Returns the MetaInfoProvider.
abstract  MetaInfo getMetaInfo(java.util.prefs.Preferences prefs)
          Return the MetaInfo object corresponding to the given Preferences.
abstract  java.util.ResourceBundle getResources(java.util.prefs.Preferences prefs)
          Return the Resource (eg internationalized Strings) that should be used together with the prefs.
static void init(MetaInfoProvider provider)
          Initializes the Singleton to be the given Object if not allready initialized.
static MetaInfoProvider init(java.lang.String className)
          Initializes the Singleton to be an Object of the given class-name and returns the instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetaInfoProvider

public MetaInfoProvider()
Method Detail

getMetaInfo

public abstract MetaInfo getMetaInfo(java.util.prefs.Preferences prefs)
Return the MetaInfo object corresponding to the given Preferences.

Parameters:
prefs - the Preferences to retrieve MetaInformations for.
Returns:
the corresponding MetaInfo

getResources

public abstract java.util.ResourceBundle getResources(java.util.prefs.Preferences prefs)
Return the Resource (eg internationalized Strings) that should be used together with the prefs. In this Resources may be stored the Strings for the keys present in MetaInfo. May return null if there are no Resources attached.

Parameters:
prefs - the Preferences to return Resources for.
Returns:
the ResourceBundle.

getInstance

public static MetaInfoProvider getInstance()
Returns the MetaInfoProvider. Or tries to get one by calling init(null) if none is present.

Returns:
the MetaInfoProvider.

init

public static MetaInfoProvider init(java.lang.String className)
                             throws MetaInfoProviderInitializationException
Initializes the Singleton to be an Object of the given class-name and returns the instance. Does it's job only if not allready initialized.

Parameters:
className - the name of the class to be instantiated.
Returns:
the MetaInfoProvider.
Throws:
MetaInfoProviderInitializationException - if there is a problem like class not found etc. Look at the cause for details.

init

public static void init(MetaInfoProvider provider)
Initializes the Singleton to be the given Object if not allready initialized.

Parameters:
provider - the initial singleton instance


Copyright © Tilmann Kuhn