Class CompilerFactoryFactory
- java.lang.Object
-
- org.codehaus.commons.compiler.CompilerFactoryFactory
-
public final class CompilerFactoryFactory extends java.lang.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(java.lang.ClassLoader classLoader)
Finds all implementation oforg.codehaus.commons.compiler
through the classLoader, then loads and instantiates the implementations'ICompilerFactory
s.static ICompilerFactory
getCompilerFactory(java.lang.String compilerFactoryClassName)
Deprecated.UsegetCompilerFactory(String, ClassLoader)
insteadstatic ICompilerFactory
getCompilerFactory(java.lang.String compilerFactoryClassName, java.lang.ClassLoader classLoader)
Loads anICompilerFactory
implementation by class name.static ICompilerFactory
getDefaultCompilerFactory()
Deprecated.UsegetDefaultCompilerFactory(ClassLoader)
insteadstatic ICompilerFactory
getDefaultCompilerFactory(java.lang.ClassLoader classLoader)
Finds the first implementation oforg.codehaus.commons.compiler
through the classLoader, then loads and instantiates the implementation'sICompilerFactory
.static java.lang.String
getSpecificationVersion()
-
-
-
Method Detail
-
getDefaultCompilerFactory
@Deprecated public static ICompilerFactory getDefaultCompilerFactory() throws java.lang.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.- Throws:
java.lang.Exception
- See Also:
- Context class loaders are for cases where you forgot to pass an explicit class loader parameter
-
getDefaultCompilerFactory
public static ICompilerFactory getDefaultCompilerFactory(java.lang.ClassLoader classLoader) throws java.lang.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:
java.lang.Exception
- Many things can go wrong while finding and initializing the default compiler factory
-
getAllCompilerFactories
@Deprecated public static ICompilerFactory[] getAllCompilerFactories() throws java.lang.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.- Throws:
java.lang.Exception
- See Also:
- Context class loaders are for cases where you forgot to pass an explicit class loader parameter
-
getAllCompilerFactories
public static ICompilerFactory[] getAllCompilerFactories(java.lang.ClassLoader classLoader) throws java.lang.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:
java.lang.Exception
- Many things can go wrong while finding and initializing the default compiler factory
-
getCompilerFactory
@Deprecated public static ICompilerFactory getCompilerFactory(java.lang.String compilerFactoryClassName) throws java.lang.Exception
Deprecated.UsegetCompilerFactory(String, ClassLoader)
insteadEquivalent 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:
java.lang.Exception
- Many things can go wrong while finding and initializing the default compiler factory
-
getCompilerFactory
public static ICompilerFactory getCompilerFactory(java.lang.String compilerFactoryClassName, java.lang.ClassLoader classLoader) throws java.lang.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:
java.lang.Exception
- Many things can go wrong while loading and initializing the default compiler factory
-
getSpecificationVersion
public static java.lang.String getSpecificationVersion()
- Returns:
- The version of the commons-compiler specification, or
null
-
-