Class ObjectRegistry


  • public class ObjectRegistry
    extends java.lang.Object
    The ObjectRegistry is used to do name-to-object reference lookups. If an ObjectRegistry is passed as a constructor argument, then this ObjectRegistry will be a cascading registry: when a lookup is invoked, it will first look in its own table for a name, and if it's not there, it will cascade to the parent ObjectRegistry. All registration is always local. [??]
    Author:
    Sanjiva Weerawarana, Matthew J. Duftler, Christopher Mindus
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object lookup​(java.lang.String name)
      Lookup an object: cascade up if needed.
      void register​(java.lang.String name, java.lang.Object obj)
      Register an object.
      void unregister​(java.lang.String name)
      Unregister an object (silent if unknown name).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ObjectRegistry

        public ObjectRegistry()
      • ObjectRegistry

        public ObjectRegistry​(java.util.Map<java.lang.String,​java.lang.Object> initialValues)
      • ObjectRegistry

        public ObjectRegistry​(ObjectRegistry parent)
        Constructor with parent registry.
        Parameters:
        parent - The parent registry.
    • Method Detail

      • register

        public void register​(java.lang.String name,
                             java.lang.Object obj)
        Register an object.
        Parameters:
        name - Object name.
        obj - The object, non-null.
      • unregister

        public void unregister​(java.lang.String name)
        Unregister an object (silent if unknown name).
        Parameters:
        name - Object name.
      • lookup

        public java.lang.Object lookup​(java.lang.String name)
                                throws java.lang.IllegalArgumentException
        Lookup an object: cascade up if needed.
        Parameters:
        name - Object name.
        Returns:
        Object found.
        Throws:
        java.lang.IllegalArgumentException - If object is not found.