Class SimpleResourceFactory

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addMapping​(java.lang.Class<? extends ResourceSpecifier> aSpecifierInterface, java.lang.Class<? extends Resource> aResourceClass)
      Configures this SimpleResourceFactory by adding a new mapping between a ResourceSpecifier class and a Resource class.
      void addMapping​(java.lang.String aSpecifierInterfaceName, java.lang.String aResourceClassName)
      Configures this SimpleResourceFactory by adding a new mapping between a ResourceSpecifier class and a Resource class.
      Resource produceResource​(java.lang.Class<? extends Resource> aResourceClass, ResourceSpecifier aSpecifier, java.util.Map<java.lang.String,​java.lang.Object> aAdditionalParams)
      Produces an appropriate Resource instance from a ResourceSpecifier.
      • Methods inherited from class java.lang.Object

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

      • LOG_RESOURCE_BUNDLE

        private static final java.lang.String LOG_RESOURCE_BUNDLE
        resource bundle for log messages
        See Also:
        Constant Field Values
      • mClassMap

        protected java.util.Map<java.lang.Class<? extends ResourceSpecifier>,​java.util.List<java.lang.Class<? extends Resource>>> mClassMap
        Map from ResourceSpecifier Class to List of Resource Classes. Resource initialization is attempted in reverse order through this List, so more recently registered classes are tried first.
    • Constructor Detail

      • SimpleResourceFactory

        public SimpleResourceFactory()
    • Method Detail

      • addMapping

        public void addMapping​(java.lang.Class<? extends ResourceSpecifier> aSpecifierInterface,
                               java.lang.Class<? extends Resource> aResourceClass)
        Configures this SimpleResourceFactory by adding a new mapping between a ResourceSpecifier class and a Resource class.
        Parameters:
        aSpecifierInterface - the subinterface of ResourceSpecifier.
        aResourceClass - a subclass of Resource that is to be instantiated from resource specifiers of the given class.
      • addMapping

        public void addMapping​(java.lang.String aSpecifierInterfaceName,
                               java.lang.String aResourceClassName)
                        throws java.lang.ClassNotFoundException
        Configures this SimpleResourceFactory by adding a new mapping between a ResourceSpecifier class and a Resource class.
        Parameters:
        aSpecifierInterfaceName - name of the subinterface of ResourceSpecifier.
        aResourceClassName - the name of a subclass of Resource that is to be instantiated from resource specifiers of the given class.
        Throws:
        java.lang.ClassNotFoundException - -