Class SpringBeanFactoryImpl

  • All Implemented Interfaces:
    org.refcodes.factory.BeanFactory<java.lang.String>, org.refcodes.factory.BeanLookupFactory<java.lang.String>, org.refcodes.factory.TypeLookupFactory


    public class SpringBeanFactoryImpl
    extends java.lang.Object
    implements org.refcodes.factory.BeanFactory<java.lang.String>
    This factory looks up beans from a spring context as provided in the constructor.
    • Constructor Summary

      Constructors 
      Constructor Description
      SpringBeanFactoryImpl​(java.net.URI[] aConfigurationFiles)
      Creates a factory with the given Spring configuration files.
      SpringBeanFactoryImpl​(java.net.URI[] aConfigurationFiles, java.net.URI[] aPropertyFiles)
      Creates a factory with the given Spring configuration files.
      SpringBeanFactoryImpl​(java.net.URI[] aConfigurationFiles, java.net.URI[] aPropertyFiles, java.util.Map<java.lang.String,java.lang.String> aProperties)
      Creates a factory with the given Spring configuration files and the given properties.
      SpringBeanFactoryImpl​(java.net.URI[] aConfigurationFiles, java.util.Map<java.lang.String,java.lang.String> aProperties)
      Creates a factory with the given Spring configuration files and the given properties.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> T createInstance​(java.lang.String aIdentifier)
      To instance.
      <T> T createInstance​(java.lang.String aIdentifier, java.util.Map<java.lang.String,java.lang.String> aProperties)
      <T> java.util.Set<T> createInstances​(java.lang.Class<?> aType)
      To instances.
      <T> java.util.Set<T> toInstances​(java.lang.Class<?> aType, java.util.Map<java.lang.String,java.lang.String> aProperties)
      To instances.
      • Methods inherited from class java.lang.Object

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

      • SpringBeanFactoryImpl

        public SpringBeanFactoryImpl​(java.net.URI[] aConfigurationFiles)
                              throws java.net.MalformedURLException
        Creates a factory with the given Spring configuration files.
        Parameters:
        aConfigurationFiles - The URIs of the configuration files describing the handled Spring application context.
        Throws:
        java.net.MalformedURLException - If a given URI is malformed.
      • SpringBeanFactoryImpl

        public SpringBeanFactoryImpl​(java.net.URI[] aConfigurationFiles,
                                     java.net.URI[] aPropertyFiles)
                              throws java.net.MalformedURLException
        Creates a factory with the given Spring configuration files. If the configuration files contains placeholders (e.g. ${jdbc.url}), the given property files are used to replace them. The provided property files have to follow the JAVA properties scheme (key=value).
        Parameters:
        aConfigurationFiles - The URIs of the configuration files describing the handled Spring application context.
        aPropertyFiles - The URIs of the property files containing the values for the used placeholders.
        Throws:
        java.net.MalformedURLException - If a given URI is malformed
      • SpringBeanFactoryImpl

        public SpringBeanFactoryImpl​(java.net.URI[] aConfigurationFiles,
                                     java.util.Map<java.lang.String,java.lang.String> aProperties)
                              throws java.net.MalformedURLException
        Creates a factory with the given Spring configuration files and the given properties. If the configuration files contains placeholders (e.g. ${jdbc.url}), the given properties are used to replace them.
        Parameters:
        aConfigurationFiles - The URIs of the configuration files describing the handled Spring application context.
        aProperties - The dynamic properties which are not defined by an configuration file.
        Throws:
        java.net.MalformedURLException - If a given URI is malformed
      • SpringBeanFactoryImpl

        public SpringBeanFactoryImpl​(java.net.URI[] aConfigurationFiles,
                                     java.net.URI[] aPropertyFiles,
                                     java.util.Map<java.lang.String,java.lang.String> aProperties)
                              throws java.net.MalformedURLException
        Creates a factory with the given Spring configuration files and the given properties. If the configuration files contains placeholders (e.g. ${jdbc.url}), the given property files and properties are used to replace them. The provided property files have to follow the JAVA properties scheme (key=value).
        Parameters:
        aConfigurationFiles - The URIs of the configuration files describing the handled Spring application context.
        aPropertyFiles - The URIs of the property files containing the values for the used placeholders.
        aProperties - The dynamic properties which are not defined by an configuration file.
        Throws:
        java.net.MalformedURLException - If a given URI is malformed
    • Method Detail

      • createInstance

        public <T> T createInstance​(java.lang.String aIdentifier)
        To instance.
        Specified by:
        createInstance in interface org.refcodes.factory.BeanFactory<java.lang.String>
        Specified by:
        createInstance in interface org.refcodes.factory.BeanLookupFactory<java.lang.String>
        Type Parameters:
        T - the generic type
        Parameters:
        aIdentifier - the identifier
        Returns:
        the t
      • createInstance

        public <T> T createInstance​(java.lang.String aIdentifier,
                                    java.util.Map<java.lang.String,java.lang.String> aProperties)
        Specified by:
        createInstance in interface org.refcodes.factory.BeanLookupFactory<java.lang.String>
      • createInstances

        public <T> java.util.Set<T> createInstances​(java.lang.Class<?> aType)
        To instances.
        Specified by:
        createInstances in interface org.refcodes.factory.BeanFactory<java.lang.String>
        Specified by:
        createInstances in interface org.refcodes.factory.TypeLookupFactory
        Type Parameters:
        T - the generic type
        Parameters:
        aType - the type
        Returns:
        the sets the
      • toInstances

        public <T> java.util.Set<T> toInstances​(java.lang.Class<?> aType,
                                                java.util.Map<java.lang.String,java.lang.String> aProperties)
        To instances.
        Specified by:
        toInstances in interface org.refcodes.factory.TypeLookupFactory
        Type Parameters:
        T - the generic type
        Parameters:
        aType - the type
        aProperties - the properties
        Returns:
        the sets the