|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.oddjob.arooa.registry.SimpleBeanRegistry
public class SimpleBeanRegistry
Register components by id and look them up by path. A ComponentRegistry is a hierarchy with child registery. The path identifies in the hierarchy where the component resides.
This class is thread safe. Beans may be registered and retrieved by different threads.
| Field Summary | |
|---|---|
static String |
RESERVED_CHARACTERS
|
| Constructor Summary | |
|---|---|
SimpleBeanRegistry()
Constructor for a local registry. |
|
SimpleBeanRegistry(PropertyAccessor propertyAccessor,
ArooaConverter converter)
|
|
| Method Summary | ||
|---|---|---|
|
getAllByType(Class<T> type)
Get all objects in the directory of the required type. |
|
String |
getIdFor(Object component)
Find the id for the given component. |
|
Object |
lookup(String path)
Get the value which is either a bean or the property of a bean. |
|
|
lookup(String path,
Class<T> required)
Get a value, as above, but also convert it into to given type. |
|
void |
register(String id,
Object component)
Register an object. |
|
void |
remove(Object component)
Remove a component from the registry if it exists. |
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String RESERVED_CHARACTERS
| Constructor Detail |
|---|
public SimpleBeanRegistry()
public SimpleBeanRegistry(PropertyAccessor propertyAccessor,
ArooaConverter converter)
| Method Detail |
|---|
public <T> Iterable<T> getAllByType(Class<T> type)
BeanDirectoryWhy an Iterable not a Collection or Set? It was thought that this would force read only use. Maybe it should be an array...
getAllByType in interface BeanDirectoryT - The required type.type - The type.
public void register(String id,
Object component)
throws InvalidIdException
register in interface BeanRegistryid - The id of the object.object - The object.
InvalidIdException
public Object lookup(String path)
throws ArooaPropertyException
BeanDirectoryThe path can be either:
lookup in interface BeanDirectoryArooaPropertyException - If property access fails.
public <T> T lookup(String path,
Class<T> required)
throws ArooaPropertyException,
ArooaConversionException
BeanDirectoryConversion in the directory is required when the client code has no access to the converters required, for instance in a nested Oddjob.
lookup in interface BeanDirectoryT - The required type.path - The full pathrequired - The required type.
ArooaPropertyException - If property access fails.
ArooaConversionException - If an object can be found but
it can't be converted into the required type.public String getIdFor(Object component)
getIdFor in interface BeanDirectorycomponent - The component.
public void remove(Object component)
remove in interface BeanRegistrycomponent - The compnent.public String toString()
toString in class Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||