ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: Playing with annotations for Ant - Sandboxable or not?
Date Mon, 12 Feb 2007 12:22:03 GMT
>I had an idea to try out using annotations in Ant - starting with a
>simple @Validation for fields.
>I know this can't be put in trunk for bwc reasons, but is it the sort
>of thing that should be considered for the sandbox?

Annotations could make life easier, indeed. Maybe via a Java5Helper?

class MyFooTask {
   String foo;
   List<Resource> resources;
   public void execute();    // via normal TaskAdapter
   Project p;                // via normal TaskAdapter

Java5Helper {
  List<Task> findTasks(Classpath);

@Task's attributes
  name - name of the task (taskdef), defaults to the classname in
         with out a "task" at the end. Here: "myfoo"
@Attribute's attributes
  name - name of the attribute to use in the xml description. Defaults
to the 
         field name. Here: <myfoo foo="">

@Element's attributes
  name - name of the nested elements. Defaults to the standard name of
the field type.
         Here: <resource>

@Validate's attributes
  class    - delegation to a custom validation class
  regexp   - string representation must match a given regexp
  min|max  - minimum and maximum size of a list

More ideas (and maybe implementations) could come from binding
frameworks (think about binding of a GUI field to a business class
(converter classes, ...))

The supporting classes could be in the Java5-conditional directory
org\apache\tools\ant\util\java15. In that way new tasks could use these
features (like the Enum's at the moment) without loosing


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message