org.springframework.build.ant
Class CompilerAdapterFactory

java.lang.Object
  extended by org.springframework.build.ant.CompilerAdapterFactory

public final class CompilerAdapterFactory
extends java.lang.Object

Creates the necessary compiler adapter, given basic criteria.

Since:
Ant 1.3

Field Summary
private static java.lang.String MODERN_COMPILER
           
 
Constructor Summary
private CompilerAdapterFactory()
          This is a singleton -- can't create instances!!
 
Method Summary
private static boolean doesModernCompilerExist()
          query for the Modern compiler existing
static org.apache.tools.ant.taskdefs.compilers.CompilerAdapter getCompiler(java.lang.String compilerType, org.apache.tools.ant.Task task)
          Based on the parameter passed in, this method creates the necessary factory desired.
private static org.apache.tools.ant.taskdefs.compilers.CompilerAdapter resolveClassName(java.lang.String className)
          Tries to resolve the given classname into a compiler adapter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODERN_COMPILER

private static final java.lang.String MODERN_COMPILER
See Also:
Constant Field Values
Constructor Detail

CompilerAdapterFactory

private CompilerAdapterFactory()
This is a singleton -- can't create instances!!

Method Detail

getCompiler

public static org.apache.tools.ant.taskdefs.compilers.CompilerAdapter getCompiler(java.lang.String compilerType,
                                                                                  org.apache.tools.ant.Task task)
                                                                           throws org.apache.tools.ant.BuildException
Based on the parameter passed in, this method creates the necessary factory desired. The current mapping for compiler names are as follows:

Parameters:
compilerType - either the name of the desired compiler, or the full classname of the compiler's adapter.
task - a task to log through.
Returns:
the compiler adapter
Throws:
org.apache.tools.ant.BuildException - if the compiler type could not be resolved into a compiler adapter.

doesModernCompilerExist

private static boolean doesModernCompilerExist()
query for the Modern compiler existing

Returns:
true if classic os on the classpath

resolveClassName

private static org.apache.tools.ant.taskdefs.compilers.CompilerAdapter resolveClassName(java.lang.String className)
                                                                                 throws org.apache.tools.ant.BuildException
Tries to resolve the given classname into a compiler adapter. Throws a fit if it can't.

Parameters:
className - The fully qualified classname to be created.
Throws:
org.apache.tools.ant.BuildException - This is the fit that is thrown if className isn't an instance of CompilerAdapter.