Class CompilerFactoryFactory


  • public final class CompilerFactoryFactory
    extends java.lang.Object
    Utility class that finds implementations of ICompilerFactorys.
    • Method Detail

      • getDefaultCompilerFactory

        public static ICompilerFactory getDefaultCompilerFactory​(java.lang.ClassLoader classLoader)
                                                          throws java.lang.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:
        java.lang.Exception - Many things can go wrong while finding and initializing the default compiler factory
      • getAllCompilerFactories

        public static ICompilerFactory[] getAllCompilerFactories​(java.lang.ClassLoader classLoader)
                                                          throws java.lang.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:
        The ICompilerFactorys 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
        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:
        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 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:
        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