org.apache.tools.ant.taskdefsClass Apt
- java.lang.Object
 
- org.apache.tools.ant.ProjectComponent
 
- org.apache.tools.ant.Task
 
- org.apache.tools.ant.taskdefs.MatchingTask
 
- org.apache.tools.ant.taskdefs.Javac
 
- org.apache.tools.ant.taskdefs.Apt
 
- All Implemented Interfaces:
 - java.lang.Cloneable, SelectorContainer
 
public class Apt extends JavacApt Task for running the Annotation processing tool for JDK 1.5. It derives from the existing Javac task, and forces the compiler based on whether we're executing internally, or externally.
- Since:
 - Ant 1.7
 
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classApt.OptionThe nested option element.
Nested classes/interfaces inherited from class org.apache.tools.ant.taskdefs.Javac
Javac.ImplementationSpecificArgument
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringERROR_IGNORING_COMPILER_OPTIONAn warning message when ignoring compiler attribute.static java.lang.StringERROR_WRONG_JAVA_VERSIONA warning message if used with java < 1.5.static java.lang.StringEXECUTABLE_NAMEThe name of the apt tool.static java.lang.StringWARNING_IGNORING_FORKexposed for debug messages
Fields inherited from class org.apache.tools.ant.taskdefs.Javac
compileList, failOnError, listFiles
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask
fileset
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
Constructor Summary
Constructors Constructor and Description Apt()Constructor for Apt task.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description PathcreateFactoryPath()Add a path to the factoryPath attribute.Apt.OptioncreateOption()Create a nested option.voidexecute()Do the compilation.java.lang.StringgetAptExecutable()Get the name of the apt executable.java.lang.StringgetCompiler()Get the compiler class name.java.lang.StringgetFactory()Get the factory option for the apt compiler.PathgetFactoryPath()Get the factory path attribute.java.util.Vector<Apt.Option>getOptions()Get the options to the compiler.java.io.FilegetPreprocessDir()Get the preprocessdir attribute.booleanisCompile()Get the compile option for the apt compiler.voidsetCompile(boolean compile)Set the compile option for the apt compiler.voidsetCompiler(java.lang.String compiler)Set the compiler.voidsetFactory(java.lang.String factory)Set the factory option for the apt compiler.voidsetFactoryPathRef(Reference ref)Add a reference to a path to the factoryPath attribute.voidsetFork(boolean fork)Set the fork attribute.voidsetPreprocessDir(java.io.File preprocessDir)Set the preprocessdir attribute.
Methods inherited from class org.apache.tools.ant.taskdefs.Javac
add, checkParameters, compile, createBootclasspath, createClasspath, createCompilerArg, createCompilerClasspath, createExtdirs, createModulepath, createModulesourcepath, createSourcepath, createSrc, createUpgrademodulepath, getBootclasspath, getClasspath, getCompilerVersion, getCurrentCompilerArgs, getDebug, getDebugLevel, getDepend, getDeprecation, getDestdir, getEncoding, getExecutable, getExtdirs, getFailonerror, getFileList, getIncludeantruntime, getIncludejavaruntime, getJavacExecutable, getListfiles, getMemoryInitialSize, getMemoryMaximumSize, getModulepath, getModulesourcepath, getNativeHeaderDir, getNowarn, getOptimize, getRelease, getSource, getSourcepath, getSrcdir, getSystemJavac, getTarget, getTaskSuccess, getTempdir, getUpgrademodulepath, getVerbose, isForkedJavac, isIncludeDestClasses, isJdkCompiler, recreateSrc, resetFileLists, scanDir, setBootclasspath, setBootClasspathRef, setClasspath, setClasspathRef, setCreateMissingPackageInfoClass, setDebug, setDebugLevel, setDepend, setDeprecation, setDestdir, setEncoding, setErrorProperty, setExecutable, setExtdirs, setFailonerror, setIncludeantruntime, setIncludeDestClasses, setIncludejavaruntime, setListfiles, setMemoryInitialSize, setMemoryMaximumSize, setModulepath, setModulepathRef, setModulesourcepath, setModulesourcepathRef, setNativeHeaderDir, setNowarn, setOptimize, setProceed, setRelease, setSource, setSourcepath, setSourcepathRef, setSrcdir, setTarget, setTempdir, setUpdatedProperty, setUpgrademodulepath, setUpgrademodulepathRef, setVerbose
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask
add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation
Field Detail
EXECUTABLE_NAME
public static final java.lang.String EXECUTABLE_NAMEThe name of the apt tool.
- See Also:
 - Constant Field Values
 
ERROR_IGNORING_COMPILER_OPTION
public static final java.lang.String ERROR_IGNORING_COMPILER_OPTIONAn warning message when ignoring compiler attribute.
- See Also:
 - Constant Field Values
 
ERROR_WRONG_JAVA_VERSION
public static final java.lang.String ERROR_WRONG_JAVA_VERSIONA warning message if used with java < 1.5.
- See Also:
 - Constant Field Values
 
WARNING_IGNORING_FORK
public static final java.lang.String WARNING_IGNORING_FORKexposed for debug messages
- See Also:
 - Constant Field Values
 
Constructor Detail
Apt
public Apt()Constructor for Apt task. This sets the apt compiler adapter as the compiler in the super class.
Method Detail
getAptExecutable
public java.lang.String getAptExecutable()Get the name of the apt executable.
- Returns:
 - the name of the executable.
 
setCompiler
public void setCompiler(java.lang.String compiler)Set the compiler. This is not allowed and a warning log message is made.
- Overrides:
 setCompilerin classJavac- Parameters:
 compiler- not used.
setFork
public void setFork(boolean fork)Set the fork attribute. Non-forking APT is highly classpath dependent and appears to be too brittle to work. The sole reason this attribute is retained is the superclass does it
getCompiler
public java.lang.String getCompiler()Get the compiler class name.
- Overrides:
 getCompilerin classJavac- Returns:
 - the compiler class name.
 - See Also:
 Javac.getCompilerVersion()
isCompile
public boolean isCompile()Get the compile option for the apt compiler. If this is false the "-nocompile" argument will be used.
- Returns:
 - the value of the compile option.
 
setCompile
public void setCompile(boolean compile)Set the compile option for the apt compiler. Default value is true.
- Parameters:
 compile- if true set the compile option.
getFactory
public java.lang.String getFactory()Get the factory option for the apt compiler. If this is non-null the "-factory" argument will be used.
- Returns:
 - the value of the factory option.
 
setFactory
public void setFactory(java.lang.String factory)Set the factory option for the apt compiler. Default value is null.
- Parameters:
 factory- the classname of the factory.
setFactoryPathRef
public void setFactoryPathRef(Reference ref)Add a reference to a path to the factoryPath attribute.
- Parameters:
 ref- a reference to a path.
createFactoryPath
public Path createFactoryPath()Add a path to the factoryPath attribute.
- Returns:
 - a path to be configured.
 
getFactoryPath
public Path getFactoryPath()Get the factory path attribute. If this is not null, the "-factorypath" argument will be used. The default value is null.
- Returns:
 - the factory path attribute.
 
createOption
public Apt.Option createOption()Create a nested option.
- Returns:
 - an option to be configured.
 
getOptions
public java.util.Vector<Apt.Option> getOptions()Get the options to the compiler. Each option will use '"-E" name ["=" value]' argument.
- Returns:
 - the options.
 
getPreprocessDir
public java.io.File getPreprocessDir()Get the preprocessdir attribute. This corresponds to the "-s" argument. The default value is null.
- Returns:
 - the preprocessdir attribute.
 
setPreprocessDir
public void setPreprocessDir(java.io.File preprocessDir)Set the preprocessdir attribute.
- Parameters:
 preprocessDir- where to place processor generated source files.
execute
public void execute() throws BuildExceptionDo the compilation.
- Overrides:
 executein classJavac- Throws:
 BuildException- on error.