Top Description Fields Constructors Methods
org.codehaus.commons.compiler

public final Class CompilerFactoryFactory

extends Object
Class Inheritance
Imports
java.util.ArrayList, .List, .ServiceLoader, org.codehaus.commons.nullanalysis.Nullable

Utility class that finds implementations of ICompilerFactorys.

Field Summary

Modifier and TypeField and Description
private static ICompilerFactory

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ICompilerFactory[]
getAllCompilerFactories()

Deprecated Use getAllCompilerFactories(ClassLoader) instead
Equivalent with getAllCompilerFactories(Thread.currentThread().getContextClassLoader()).
public static ICompilerFactory[]

Returns:

The ICompilerFactorys of all implementations that were loaded
getAllCompilerFactories
(ClassLoader classLoader)

Finds all implementation of org.codehaus.commons.compiler through the classLoader, then loads and instantiates the implementations' ICompilerFactorys.

public static ICompilerFactory
getCompilerFactory(String
Name of a class that implements ICompilerFactory
compilerFactoryClassName
)

Equivalent with getCompilerFactory(Thread.currentThread().getContextClassLoader()).
public static ICompilerFactory
getCompilerFactory(String
Name of a class that implements ICompilerFactory
compilerFactoryClassName
,
ClassLoader classLoader)

Loads an ICompilerFactory implementation by class name.

public static ICompilerFactory
getDefaultCompilerFactory()

Equivalent with getDefaultCompilerFactory(Thread.currentThread().getContextClassLoader()).
public static ICompilerFactory

Returns:

The ICompilerFactory of the first implementation that was loaded
getDefaultCompilerFactory
(ClassLoader classLoader)

Finds the first implementation of org.codehaus.commons.compiler through the classLoader, then loads and instantiates the implementation's ICompilerFactory.

public static String

Returns:

The version of the commons-compiler specification, or null
getSpecificationVersion
()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultCompilerFactoryback to summary
private static ICompilerFactory defaultCompilerFactory
Annotations
@Nullable

Constructor Detail

CompilerFactoryFactoryback to summary
private CompilerFactoryFactory()

Method Detail

getAllCompilerFactoriesback to summary
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.

Annotations
@Deprecated
See Also
Context class loaders are for cases where you forgot to pass an explicit class loader parameter
getAllCompilerFactoriesback to summary
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' ICompilerFactorys.

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:ICompilerFactory[]

The ICompilerFactorys of all implementations that were loaded

Exceptions
Exception:
Many things can go wrong while finding and initializing the default compiler factory
getCompilerFactoryback to summary
public static ICompilerFactory getCompilerFactory(String compilerFactoryClassName) throws Exception

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:String

Name of a class that implements ICompilerFactory

Annotations
@Deprecated
Exceptions
Exception:
Many things can go wrong while finding and initializing the default compiler factory
getCompilerFactoryback to summary
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:String

Name of a class that implements ICompilerFactory

Exceptions
Exception:
Many things can go wrong while loading and initializing the default compiler factory
getDefaultCompilerFactoryback to summary
public static ICompilerFactory getDefaultCompilerFactory() throws Exception

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.

Annotations
@Deprecated
See Also
Context class loaders are for cases where you forgot to pass an explicit class loader parameter
getDefaultCompilerFactoryback to summary
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:ICompilerFactory

The ICompilerFactory of the first implementation that was loaded

Exceptions
Exception:
Many things can go wrong while finding and initializing the default compiler factory
getSpecificationVersionback to summary
public static String getSpecificationVersion()
Returns:String

The version of the commons-compiler specification, or null