org.apache.cayenne.di.spi

## Class DefaultAdhocObjectFactory

- java.lang.Object
- - org.apache.cayenne.di.spi.DefaultAdhocObjectFactory

- All Implemented Interfaces:
    AdhocObjectFactory

      public class DefaultAdhocObjectFactory
      extends Object
      implements AdhocObjectFactory

  A default implementation of `AdhocObjectFactory` that creates objects using default no-arg constructor and injects dependencies into annotated fields. Note that constructor injection is not supported by this factory.
  Since:
    3.1

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ClassLoaderManager` | `classLoaderManager`
    `protected Injector` | `injector`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultAdhocObjectFactory(Injector injector, ClassLoaderManager classLoaderManager)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Class<?>` | `getJavaClass(String className)` Returns a Java class loaded using ClassLoader returned from `ClassLoaderManager.getClassLoader(String)` for a given class name.
    `<T> T` | `newInstance(Class<? super T> superType, String className)` Returns an instance of "className" that implements "superType", injecting dependencies from the registry into it.

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

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

- - ### Field Detail

    - #### injector

          protected Injector injector

    - #### classLoaderManager

          protected ClassLoaderManager classLoaderManager

  - ### Constructor Detail

    - #### DefaultAdhocObjectFactory

          public DefaultAdhocObjectFactory(Injector injector,
                                           ClassLoaderManager classLoaderManager)

      Since:
        4.0

  - ### Method Detail

    - #### newInstance

          public <T> T newInstance(Class<? super T> superType,
                                   String className)

      Description copied from interface: `AdhocObjectFactory`
      Returns an instance of "className" that implements "superType", injecting dependencies from the registry into it.
      Specified by:
        `newInstance` in interface `AdhocObjectFactory`

    - #### getJavaClass

          public Class<?> getJavaClass(String className)

      Description copied from interface: `AdhocObjectFactory`
      Returns a Java class loaded using ClassLoader returned from `ClassLoaderManager.getClassLoader(String)` for a given class name.
      Specified by:
        `getJavaClass` in interface `AdhocObjectFactory`

Copyright © 2001–2018 Apache Cayenne. All rights reserved.