Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

org.alfresco.util.registry
Class NamedObjectRegistry<T>
java.lang.Object
  org.alfresco.util.registry.NamedObjectRegistry<T>

public class NamedObjectRegistry<T>
extends Object
An generic registry of objects held by name. This is effectively a strongly-typed, synchronized map.
Since:
3.2
Author:
Derek Hulley

Constructor Summary
NamedObjectRegistry()
          Default constructor.
NamedObjectRegistry(Class<T> type)
          Constructor that takes care of setStorageType(Class).
Method Summary
getAllNamedObjects()
getNamedObject(String name)
          Get a named object if it has been registered
void
register(String name, T object)
          Register a named object instance.
void
reset()
void
setNamePattern(String namePattern)
          Optionally set a pattern to which all object names must conform
void
setStorageType(Class<T> clazz)
          Set the type of class that the registry holds.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail
NamedObjectRegistry
public NamedObjectRegistry()
Default constructor. The setStorageType(Class) method must be called.

NamedObjectRegistry
public NamedObjectRegistry(Class<T> type)
Constructor that takes care of setStorageType(Class).
See Also:
setStorageType(Class)
Method Detail
setStorageType
public void setStorageType(Class<T> clazz)
Set the type of class that the registry holds. Any attempt to register a an instance of another type will be rejected.
Parameters:
clazz - the type to store

setNamePattern
public void setNamePattern(String namePattern)
Optionally set a pattern to which all object names must conform
Parameters:
namePattern - a regular expression

register
public void register(String name,
                     T object)
Register a named object instance.
Parameters:
name - the name of the object
object - the instance to register, which correspond to the type

getNamedObject
public T getNamedObject(String name)
Get a named object if it has been registered
Parameters:
name - the name of the object to retrieve
Returns:
Returns the instance of the object, which will necessarily be of the correct type, or null

getAllNamedObjects
public Map<String,TgetAllNamedObjects()
Returns:
Returns a copy of the map of instances

reset
public void reset()

Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2016 Alfresco Software. All rights reserved.

Java API documentation generated with DocFlex/Javadoc 1.6.1 using JavadocPro template set.