Package org.codehaus.commons.compiler

# Class CompilerFactoryFactory

java.lang.Object
org.codehaus.commons.compiler.CompilerFactoryFactory

public final class CompilerFactoryFactory extends Object
Utility class that finds implementations of `ICompilerFactory`s.

## Method Summary

Modifier and Type
Method
Description
`static ICompilerFactory[]`
`getAllCompilerFactories()`
Deprecated.
Use `getAllCompilerFactories(ClassLoader)` instead
`static ICompilerFactory[]`
`getAllCompilerFactories(ClassLoader classLoader)`
Finds all implementation of `org.codehaus.commons.compiler` through the classLoader, then loads and instantiates the implementations' `ICompilerFactory`s.
`static ICompilerFactory`
`getCompilerFactory(String compilerFactoryClassName)`
Deprecated.
Use `getCompilerFactory(String, ClassLoader)` instead
`static ICompilerFactory`
`getCompilerFactory(String compilerFactoryClassName, ClassLoader classLoader)`
Loads an `ICompilerFactory` implementation by class name.
`static ICompilerFactory`
`getDefaultCompilerFactory()`
Deprecated.
Use `getDefaultCompilerFactory(ClassLoader)` instead
`static ICompilerFactory`
`getDefaultCompilerFactory(ClassLoader classLoader)`
Finds the first implementation of `org.codehaus.commons.compiler` through the classLoader, then loads and instantiates the implementation's `ICompilerFactory`.
`static String`
`getSpecificationVersion()`

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

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

## Method Details

### getDefaultCompilerFactory

@Deprecated public static ICompilerFactory getDefaultCompilerFactory() throws Exception
Deprecated.
Use `getDefaultCompilerFactory(ClassLoader)` instead
Equivalent with `getDefaultCompilerFactory(Thread.currentThread().getContextClassLoader())`. The context class loader is typically a bad choice, because frameworks use (abuse?) the context class loader for different purposes, which causes problems in individual contexts.

Throws:
  `Exception`
See Also:
  - Context class loaders are for cases where you forgot to pass an explicit class loader parameter

### getDefaultCompilerFactory

public static ICompilerFactory getDefaultCompilerFactory(ClassLoader classLoader) throws Exception
Finds the first implementation of `org.codehaus.commons.compiler` through the classLoader, then loads and instantiates the implementation's `ICompilerFactory`.

If the implementation is on the application class path (which is the case for probably 99% of all environments), then the correct class loader to use would be `ClassLoader.getSystemClassLoader()`.

Returns:
  The `ICompilerFactory` of the first implementation that was loaded
Throws:
  `Exception` - Many things can go wrong while finding and initializing the default compiler factory

### getAllCompilerFactories

@Deprecated public static ICompilerFactory[] getAllCompilerFactories() throws Exception
Deprecated.
Use `getAllCompilerFactories(ClassLoader)` instead
Equivalent with `getAllCompilerFactories(Thread.currentThread().getContextClassLoader())`. The context class loader is typically a bad choice, because frameworks use (abuse?) the context class loader for different purposes, which causes problems in individual contexts.

Throws:
  `Exception`
See Also:
  - Context class loaders are for cases where you forgot to pass an explicit class loader parameter

### getAllCompilerFactories

public static ICompilerFactory[] getAllCompilerFactories(ClassLoader classLoader) throws Exception
Finds all implementation of `org.codehaus.commons.compiler` through the classLoader, then loads and instantiates the implementations' `ICompilerFactory`s.

If the implementations are on the application class path (which is the case for probably 99% of all environments), then the correct class loader to use would be `ClassLoader.getSystemClassLoader()`.

Returns:
  The `ICompilerFactory`s of all implementations that were loaded
Throws:
  `Exception` - Many things can go wrong while finding and initializing the default compiler factory

### getCompilerFactory

@Deprecated public static ICompilerFactory getCompilerFactory(String compilerFactoryClassName) throws Exception
Deprecated.
Use `getCompilerFactory(String, ClassLoader)` instead
Equivalent with `getCompilerFactory(Thread.currentThread().getContextClassLoader())`.

If the implementation is on the application class path (which is the case for probably 99% of all environments), then the correct class loader to use would be `ClassLoader.getSystemClassLoader()`.

Parameters:
  `compilerFactoryClassName` - Name of a class that implements `ICompilerFactory`
Throws:
  `Exception` - Many things can go wrong while finding and initializing the default compiler factory

### getCompilerFactory

public static ICompilerFactory getCompilerFactory(String compilerFactoryClassName, ClassLoader classLoader) throws Exception
Loads an `ICompilerFactory` implementation by class name.

If the implementation is on the application class path (which is the case for probably 99% of all environments), then the correct class loader to use would be `ClassLoader.getSystemClassLoader()`.

Parameters:
  `compilerFactoryClassName` - Name of a class that implements `ICompilerFactory`
Throws:
  `Exception` - Many things can go wrong while loading and initializing the default compiler factory

### getSpecificationVersion

public static String getSpecificationVersion()

Returns:
  The version of the commons-compiler specification, or `null`