Package org.deckfour.xes.util
Class XRegistry<T>
- java.lang.Object
-
- org.deckfour.xes.util.XRegistry<T>
-
- Direct Known Subclasses:
XFactoryRegistry,XParserRegistry,XSerializerRegistry
public abstract class XRegistry<T> extends java.lang.ObjectTemplate implementation for a generic registry.- Author:
- Christian W. Guenther (christian@deckfour.org)
-
-
Constructor Summary
Constructors Constructor Description XRegistry()Instantiates a new registry.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract booleanareEqual(T a, T b)Subclasses must implement this method.TcurrentDefault()Retrieves the current default instance.java.util.Set<T>getAvailable()Retrieves a set of all available instances.protected booleanisContained(T instance)Checks whether the given instance is already contained in the registry.voidregister(T instance)Registers a new instance with this registry.voidsetCurrentDefault(T instance)Sets the current default instance of this registry.
-
-
-
Method Detail
-
getAvailable
public java.util.Set<T> getAvailable()
Retrieves a set of all available instances.
-
currentDefault
public T currentDefault()
Retrieves the current default instance.
-
register
public void register(T instance)
Registers a new instance with this registry.- Parameters:
instance- Instance to be registered.
-
setCurrentDefault
public void setCurrentDefault(T instance)
Sets the current default instance of this registry.- Parameters:
instance- Instance to be the current default of this registry.
-
areEqual
protected abstract boolean areEqual(T a, T b)
Subclasses must implement this method. It is used by the registry to ensure that no duplicates are inserted.- Parameters:
a- An instance a.b- Another instance b.- Returns:
- Whether the instances a and b are equivalent.
-
isContained
protected boolean isContained(T instance)
Checks whether the given instance is already contained in the registry.- Parameters:
instance- Instance to check against registry.- Returns:
- Whether the given instance is already registered.
-
-