Class CompilerFactoryFactory
- java.lang.Object
-
- org.codehaus.commons.compiler.CompilerFactoryFactory
-
public final class CompilerFactoryFactory extends Object
Utility class that finds implementations ofICompilerFactorys.
-
-
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.compilerthrough the classLoader, then loads and instantiates the implementations'ICompilerFactorys.static ICompilerFactorygetCompilerFactory(String compilerFactoryClassName)Deprecated.static ICompilerFactorygetCompilerFactory(String compilerFactoryClassName, ClassLoader classLoader)Loads anICompilerFactoryimplementation by class name.static ICompilerFactorygetDefaultCompilerFactory()Deprecated.UsegetDefaultCompilerFactory(ClassLoader)insteadstatic ICompilerFactorygetDefaultCompilerFactory(ClassLoader classLoader)Finds the first implementation oforg.codehaus.commons.compilerthrough the classLoader, then loads and instantiates the implementation'sICompilerFactory.static StringgetSpecificationVersion()
-
-
-
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.compilerthrough 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
ICompilerFactoryof 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.compilerthrough 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:
- The
ICompilerFactorys 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 anICompilerFactoryimplementation 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
-
-