Class CompilerFactoryFactory
- java.lang.Object
-
- org.codehaus.commons.compiler.CompilerFactoryFactory
-
public final class CompilerFactoryFactory extends Object
Utility class that finds implementations ofICompilerFactory
s.
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ICompilerFactory[]
getAllCompilerFactories()
Deprecated.UsegetAllCompilerFactories(ClassLoader)
insteadstatic ICompilerFactory[]
getAllCompilerFactories(ClassLoader classLoader)
Finds all implementation oforg.codehaus.commons.compiler
through the classLoader, then loads and instantiates the implementations'ICompilerFactory
s.static ICompilerFactory
getCompilerFactory(String compilerFactoryClassName)
Deprecated.static ICompilerFactory
getCompilerFactory(String compilerFactoryClassName, ClassLoader classLoader)
Loads anICompilerFactory
implementation by class name.static ICompilerFactory
getDefaultCompilerFactory()
Deprecated.UsegetDefaultCompilerFactory(ClassLoader)
insteadstatic ICompilerFactory
getDefaultCompilerFactory(ClassLoader classLoader)
Finds the first implementation oforg.codehaus.commons.compiler
through the classLoader, then loads and instantiates the implementation'sICompilerFactory
.static String
getSpecificationVersion()
-
-
-
Method Detail
-
getDefaultCompilerFactory
@Deprecated public static ICompilerFactory getDefaultCompilerFactory() throws Exception
Deprecated.UsegetDefaultCompilerFactory(ClassLoader)
insteadEquivalent withgetDefaultCompilerFactory(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.
-
getDefaultCompilerFactory
public static ICompilerFactory getDefaultCompilerFactory(ClassLoader classLoader) throws Exception
Finds the first implementation oforg.codehaus.commons.compiler
through the classLoader, then loads and instantiates the implementation'sICompilerFactory
.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.UsegetAllCompilerFactories(ClassLoader)
insteadEquivalent withgetAllCompilerFactories(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.
-
getAllCompilerFactories
public static ICompilerFactory[] getAllCompilerFactories(ClassLoader classLoader) throws Exception
Finds all implementation oforg.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.Equivalent withgetCompilerFactory(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 implementsICompilerFactory
- 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 anICompilerFactory
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 implementsICompilerFactory
- 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
-
-