Class ACTask

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
com.sun.codemodel.ac.ACTask
All Implemented Interfaces:
Cloneable

public class ACTask extends org.apache.tools.ant.Task
Annotation compiler ant task.

This task reads annotation classes and generate strongly-typed writers.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Nested <classes> elements.
    static class 
    Nested <endorse> elements.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final org.apache.tools.ant.types.Path
    Used to load additional user-specified classes.
    private JCodeModel
    Generated interfaces go into this codeModel.
    private final List<URL>
     
    private File
    Output directory
    private final List<ACTask.Classes>
     
    private JPackage
    The writers will be generated into this package.
    private final Map<Class,JDefinedClass>
    Map from annotation classes to their writers.
    private ClassLoader
    Used during the build to load annotation classes.

    Fields inherited from class org.apache.tools.ant.Task

    target, taskName, taskType, wrapper

    Fields inherited from class org.apache.tools.ant.ProjectComponent

    description, location, project
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    List of classes to be handled
    void
    List of endorsed jars
    org.apache.tools.ant.types.Path
    Nested <classpath> element.
    void
     
    private static String
    getShortName(String className)
    Gets the short name from a fully-qualified name.
    private void
    process(String name, long timestamp)
    Process a file.
    private void
    processDir(File dir, String prefix)
    Visits a directory and looks for classes that match the specified pattern.
    private void
    processJar(File jarfile)
    Visits a jar fil and looks for classes that match the specified pattern.
    private void
    queue(String className, long timestamp)
    Queues a file for generation.
    void
    setClasspath(org.apache.tools.ant.types.Path cp)
    Nested <classpath> element.
    void
    setClasspathRef(org.apache.tools.ant.types.Reference r)
     
    void
    setDestdir(File output)
     
    void
    setPackage(String pkgName)
     
    void
    setProject(org.apache.tools.ant.Project project)
     

    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

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • classpath

      private final org.apache.tools.ant.types.Path classpath
      Used to load additional user-specified classes.
    • endorsedJars

      private final List<URL> endorsedJars
    • patterns

      private final List<ACTask.Classes> patterns
    • userLoader

      private ClassLoader userLoader
      Used during the build to load annotation classes.
    • codeModel

      private JCodeModel codeModel
      Generated interfaces go into this codeModel.
    • pkg

      private JPackage pkg
      The writers will be generated into this package.
    • output

      private File output
      Output directory
    • queue

      private final Map<Class,JDefinedClass> queue
      Map from annotation classes to their writers.
  • Constructor Details

    • ACTask

      public ACTask()
  • Method Details

    • setProject

      public void setProject(org.apache.tools.ant.Project project)
      Overrides:
      setProject in class org.apache.tools.ant.ProjectComponent
    • setPackage

      public void setPackage(String pkgName)
    • setClasspath

      public void setClasspath(org.apache.tools.ant.types.Path cp)
      Nested <classpath> element.
    • createClasspath

      public org.apache.tools.ant.types.Path createClasspath()
      Nested <classpath> element.
    • setClasspathRef

      public void setClasspathRef(org.apache.tools.ant.types.Reference r)
    • setDestdir

      public void setDestdir(File output)
    • addConfiguredClasses

      public void addConfiguredClasses(ACTask.Classes c)
      List of classes to be handled
    • addConfiguredEndorse

      public void addConfiguredEndorse(ACTask.Endorse e)
      List of endorsed jars
    • execute

      public void execute() throws org.apache.tools.ant.BuildException
      Overrides:
      execute in class org.apache.tools.ant.Task
      Throws:
      org.apache.tools.ant.BuildException
    • processJar

      private void processJar(File jarfile)
      Visits a jar fil and looks for classes that match the specified pattern.
    • processDir

      private void processDir(File dir, String prefix)
      Visits a directory and looks for classes that match the specified pattern.
      Parameters:
      prefix - the package name prefix like "" or "foo/bar/"
    • process

      private void process(String name, long timestamp)
      Process a file.
      Parameters:
      name - such as "javax/xml/bind/Abc.class"
    • queue

      private void queue(String className, long timestamp)
      Queues a file for generation.
    • getShortName

      private static String getShortName(String className)
      Gets the short name from a fully-qualified name.