org.apache.tamaya.inject.internal

## Class DefaultConfigurationInjector

- java.lang.Object
- - org.apache.tamaya.inject.internal.DefaultConfigurationInjector

- All Implemented Interfaces:
    ConfigurationInjector

      @Priority(value=0)
      public final class DefaultConfigurationInjector
      extends Object
      implements ConfigurationInjector

  Simple injector singleton that also registers instances configured using weak references.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultConfigurationInjector()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> T` | `configure(T instance)` Configured the current instance and reigsterd necessary listener to forward config change events as defined by the current annotations in place.
    `<T> T` | `configure(T instance, org.apache.tamaya.Configuration config)` Configured the current instance and reigsterd necessary listener to forward config change events as defined by the current annotations in place.
    `<T> T` | `createTemplate(Class<T> templateType)` Create a template implementting the annotated methods based on current configuration data.
    `<T> T` | `createTemplate(Class<T> templateType, org.apache.tamaya.Configuration config)` Create a template implementting the annotated methods based on current configuration data.
    `<T> org.apache.tamaya.inject.api.ConfiguredItemSupplier<T>` | `getConfiguredSupplier(org.apache.tamaya.inject.api.ConfiguredItemSupplier<T> supplier)` Creates a supplier for configured instances of the given type `T`.
    `<T> org.apache.tamaya.inject.api.ConfiguredItemSupplier<T>` | `getConfiguredSupplier(org.apache.tamaya.inject.api.ConfiguredItemSupplier<T> supplier, org.apache.tamaya.Configuration config)` Creates a supplier for configured instances of the given type `T`.
    `org.apache.tamaya.inject.spi.ConfiguredType` | `registerType(Class<?> type)` Extract the configuration annotation config and registers it per class, for later reuse.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultConfigurationInjector

          public DefaultConfigurationInjector()

  - ### Method Detail

    - #### registerType

          public org.apache.tamaya.inject.spi.ConfiguredType registerType(Class<?> type)

      Extract the configuration annotation config and registers it per class, for later reuse.
      Parameters:
        `type` - the type to be configured.
      Returns:
        the configured type registered.

    - #### configure

          public <T> T configure(T instance)

      Configured the current instance and reigsterd necessary listener to forward config change events as defined by the current annotations in place.
      Specified by:
        `configure` in interface `ConfigurationInjector`
      Type Parameters:
        `T` - the type of the instance.
      Parameters:
        `instance` - the instance to be configured
      Returns:
        the configured instance (allows chaining of operations).

    - #### configure

          public <T> T configure(T instance,
                        org.apache.tamaya.Configuration config)

      Configured the current instance and reigsterd necessary listener to forward config change events as defined by the current annotations in place.
      Specified by:
        `configure` in interface `ConfigurationInjector`
      Type Parameters:
        `T` - the type of the instance.
      Parameters:
        `instance` - the instance to be configured
        `config` - the target configuration, not null.
      Returns:
        the configured instance (allows chaining of operations).

    - #### createTemplate

          public <T> T createTemplate(Class<T> templateType)

      Create a template implementting the annotated methods based on current configuration data.
      Specified by:
        `createTemplate` in interface `ConfigurationInjector`
      Type Parameters:
        `T` - the type of the template.
      Parameters:
        `templateType` - the type of the template to be created.
      Returns:
        the configured template.

    - #### createTemplate

          public <T> T createTemplate(Class<T> templateType,
                             org.apache.tamaya.Configuration config)

      Create a template implementting the annotated methods based on current configuration data.
      Specified by:
        `createTemplate` in interface `ConfigurationInjector`
      Type Parameters:
        `T` - the type of the template.
      Parameters:
        `templateType` - the type of the template to be created.
        `config` - the target configuration, not null.
      Returns:
        the configured template.

    - #### getConfiguredSupplier

          public <T> org.apache.tamaya.inject.api.ConfiguredItemSupplier<T> getConfiguredSupplier(org.apache.tamaya.inject.api.ConfiguredItemSupplier<T> supplier)

      Description copied from interface: `ConfigurationInjector`
      Creates a supplier for configured instances of the given type `T`.
      Specified by:
        `getConfiguredSupplier` in interface `ConfigurationInjector`
      Type Parameters:
        `T` - the target type.
      Parameters:
        `supplier` - the supplier to create new instances.
      Returns:
        a supplier creating configured instances of `T`.

    - #### getConfiguredSupplier

          public <T> org.apache.tamaya.inject.api.ConfiguredItemSupplier<T> getConfiguredSupplier(org.apache.tamaya.inject.api.ConfiguredItemSupplier<T> supplier,
                                                                                         org.apache.tamaya.Configuration config)

      Description copied from interface: `ConfigurationInjector`
      Creates a supplier for configured instances of the given type `T`.
      Specified by:
        `getConfiguredSupplier` in interface `ConfigurationInjector`
      Type Parameters:
        `T` - the target type.
      Parameters:
        `supplier` - the supplier to create new instances.
        `config` - the configuration to be used for backing the supplier.
      Returns:
        a supplier creating configured instances of `T`.

Copyright © 2014–2016 Apache Software Foundation. All rights reserved.