Class InjectableObjectContainer


  • public class InjectableObjectContainer
    extends Object
    InjectableObjectContainer maintains a collection of objects which were provided as possible default values for unassigned, injectable properties of configuration objects. It can retrieve the default object which suits the requested type.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(Object defaultObject)
      Registers the supplied object as a default object.
      Object get​(Class<?> type)
      Returns the default object which is suitable for the specified type.
      • Methods inherited from class java.lang.Object

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

      • InjectableObjectContainer

        public InjectableObjectContainer()
    • Method Detail

      • add

        public void add​(Object defaultObject)
        Registers the supplied object as a default object.
        Parameters:
        defaultObject - The object to be registered
      • get

        public Object get​(Class<?> type)
                   throws IllegalArgumentException
        Returns the default object which is suitable for the specified type.
        Parameters:
        type - The type for which a default object is requested.
        Returns:
        The single suitable object which was found.
        Throws:
        IllegalArgumentException - if zero or more than one object has been registered which is assignable to the specified type.