Class DefaultRepository

  • All Implemented Interfaces:
    Repository

    public class DefaultRepository
    extends java.lang.Object
    implements Repository
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.SortedMap<java.lang.String,​java.lang.Object> instances
      The unmarshaled object instances by name.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(java.lang.String name, java.lang.Object instance)
      Add an object instance to this repository.
      boolean contains​(java.lang.String name)
      Does this repository contain a object with the specified name.
      java.lang.Object get​(java.lang.String name)
      Gets the object or recipe with the specified name from this repository.
      • Methods inherited from class java.lang.Object

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

      • instances

        private final java.util.SortedMap<java.lang.String,​java.lang.Object> instances
        The unmarshaled object instances by name.
    • Constructor Detail

      • DefaultRepository

        public DefaultRepository()
    • Method Detail

      • contains

        public boolean contains​(java.lang.String name)
        Does this repository contain a object with the specified name.
        Specified by:
        contains in interface Repository
        Parameters:
        name - the unique name of the object instance
        Returns:
        true if this repository contain a object with the specified name
      • get

        public java.lang.Object get​(java.lang.String name)
        Gets the object or recipe with the specified name from this repository.
        Specified by:
        get in interface Repository
        Parameters:
        name - the unique name of the object instance
        Returns:
        the object instance, a recipe to build the object or null
      • add

        public void add​(java.lang.String name,
                        java.lang.Object instance)
        Add an object instance to this repository.
        Specified by:
        add in interface Repository
        Parameters:
        name - the unique name of the instance
        instance - the instance
        Throws:
        ConstructionException - if another object instance is already registered with the name