public class DictionaryFactory extends Object
Every instance of the Dictionary
interface must register an
Implementation
object. The objects are then used to find a matching dictionary implementation for a descriptor.
Modifier and Type | Method and Description |
---|---|
static Dictionary |
createDictionary(String descriptor)
Creates a dictionary instance based on the descriptor.
|
static DictionaryImplementation<?> |
getImplementation(String descriptor)
Returns the dictionary implementation which best matches the descriptor.
|
static <T extends Dictionary> |
registerImplementation(DictionaryImplementation<T> imp)
Registers an implementation of the
Dictionary interface with the
DictionaryFactory . |
static Dictionary |
synchronizedDictionary(Dictionary dictionary)
Returns a synchronized (thread-safe) dictionary wrapped by the specified
dictionary.
|
static IndexedDictionary |
synchronizedIndexedDictionary(IndexedDictionary dictionary)
Returns a synchronized (thread-safe) indexed dictionary wrapped by the specified
indexed dictionary.
|
public static Dictionary createDictionary(String descriptor) throws UnsupportedDescriptorException, DictionaryInstantiationException
Dictionary
instance.descriptor
- Description of a dictionary instance.Dictionary
instance based on the descriptor.UnsupportedDescriptorException
- if the descriptor can not be matched to a known dictionary
format.InstantiationExeption
- if the creation of the dictionary instance fails.DictionaryInstantiationException
public static Dictionary synchronizedDictionary(Dictionary dictionary)
dictionary
- Dictionary to be wrapped in a synchronized instance.IndexedDictionary
, the returned instance
will also be.public static IndexedDictionary synchronizedIndexedDictionary(IndexedDictionary dictionary)
dictionary
- Dictionary to be wrapped in a synchronized instance.public static DictionaryImplementation<?> getImplementation(String descriptor) throws UnsupportedDescriptorException
descriptor
- Description of a dictionary instance.UnsupportedDescriptorException
- if the descriptor does not match a known dictionary format.public static <T extends Dictionary> void registerImplementation(DictionaryImplementation<T> imp)
Dictionary
interface with the
DictionaryFactory
. The registered implementation will be used
to match descriptors to the dictionary and create new instances of the dictionary.imp
- Implementation
object which describes the implementation.Copyright © 2001-2013 the JGloss developers. All Rights Reserved.