Class LinkedBeanRegistry

java.lang.Object
org.oddjob.arooa.registry.SimpleBeanRegistry
org.oddjob.arooa.registry.LinkedBeanRegistry
All Implemented Interfaces:
BeanDirectory, BeanRegistry

public class LinkedBeanRegistry extends SimpleBeanRegistry
A BeanRegistry that will attempt to find a bean value in an existing BeanDirectory if it hasn't been registered with this registry.
Author:
rob
  • Constructor Details

    • LinkedBeanRegistry

      public LinkedBeanRegistry(BeanDirectory existingDirectory, PropertyAccessor propertyAccessor, ArooaConverter converter)
      Constructor.
      Parameters:
      existingDirectory -
      propertyAccessor -
      converter -
    • LinkedBeanRegistry

      public LinkedBeanRegistry(ArooaSession existingSession)
      A constructor that takes takes the existing directory and tools from the given session.
      Parameters:
      existingSession -
  • Method Details

    • lookup

      public Object lookup(String path)
      First try our local registry then the parent.
      Specified by:
      lookup in interface BeanDirectory
      Overrides:
      lookup in class SimpleBeanRegistry
      Parameters:
      path - The path.
      Returns:
      The resultant value or null.
    • lookup

      public <T> T lookup(String path, Class<T> required) throws ArooaConversionException
      Description copied from interface: BeanDirectory
      Get a value, as above, but also convert it into to given type.

      Conversion in the directory is required when the client code has no access to the converters required, for instance in a nested Oddjob.

      Specified by:
      lookup in interface BeanDirectory
      Overrides:
      lookup in class SimpleBeanRegistry
      Type Parameters:
      T - The required type.
      Parameters:
      path - The full path
      required - The required type.
      Returns:
      An object of the required type or null if none can be found.
      Throws:
      ArooaConversionException - If an object can be found but it can't be converted into the required type.
    • getIdFor

      public String getIdFor(Object bean)
      Description copied from class: SimpleBeanRegistry
      Find the id for the given component.
      Specified by:
      getIdFor in interface BeanDirectory
      Overrides:
      getIdFor in class SimpleBeanRegistry
      Parameters:
      bean - The component.
      Returns:
      The id or null if none can be found.
    • getAllByType

      public <T> Iterable<T> getAllByType(Class<T> type)
      Description copied from interface: BeanDirectory
      Get all objects in the directory of the required type.

      Why an Iterable not a Collection or Set? It was thought that this would force read only use. Maybe it should be an array...

      Specified by:
      getAllByType in interface BeanDirectory
      Overrides:
      getAllByType in class SimpleBeanRegistry
      Type Parameters:
      T - The required type.
      Parameters:
      type - The type.
      Returns:
      An Iterable for matches. Never null.