org.grinvin.util

Class SingletonBroker<T>


public class SingletonBroker<T>
extends java.lang.Object

An object of this type keeps track of a set of singleton objects of type T which can be requested by id. The list of available singleton objects is instantiated at initialization time. An XML configuration file determines which objects should be instantiated.

Constructor Summary

SingletonBroker(String configPath)
Instantiates a broker object and loads the corresponding objects.

Method Summary

void
addToList(List list)
Add all singleton objects to the given list.
T
get(String id)
Return the object with the given id.
Iterable
getIds()
Return the list of all ids, in the form of an Iterable.

Constructor Details

SingletonBroker

public SingletonBroker(String configPath)
Instantiates a broker object and loads the corresponding objects.
Parameters:
configPath - file name in the class path of the XML file with the requested objects

Method Details

addToList

public void addToList(List list)
Add all singleton objects to the given list.

get

public T get(String id)
Return the object with the given id.

getIds

public Iterable getIds()
Return the list of all ids, in the form of an Iterable.