AdhocObjectFactory (cayenne-doc: Cayenne Documentation 5.0-M2 API)
Description: declaration: package: org.apache.cayenne.di, interface: AdhocObjectFactory

# Interface AdhocObjectFactory

All Known Implementing Classes:
  `DefaultAdhocObjectFactory`

public interface AdhocObjectFactory
Creates objects for user-provided String class names, injecting dependencies into them.

Since:
  3.1

- ## Method Summary

  Modifier and Type
  Method
  Description
  `<T> Class<? extends T>`
  `getJavaClass(String className)`
  Returns a Java class loaded using ClassLoader returned from `ClassLoaderManager.getClassLoader(String)` for a given class name.
  `default <T> T`
  `newInstance(Class<? super T> superType, String className)`
  Returns an instance of "className" that implements "superType", injecting dependencies from the registry into it.
  `<T> T`
  `newInstance(Class<? super T> superType, String className, boolean skipInjection)`
  Returns an instance of "className" that implements "superType", injecting dependencies from the registry into it if requested

- ## Method Details

  - ### newInstance

    default <T> T newInstance(Class<? super T> superType, String className)
    Returns an instance of "className" that implements "superType", injecting dependencies from the registry into it.

  - ### newInstance

    <T> T newInstance(Class<? super T> superType, String className, boolean skipInjection)
    Returns an instance of "className" that implements "superType", injecting dependencies from the registry into it if requested
    Since:
      5.0

  - ### getJavaClass

    <T> Class<? extends T> getJavaClass(String className)
    Returns a Java class loaded using ClassLoader returned from `ClassLoaderManager.getClassLoader(String)` for a given class name.
    Since:
      4.0