>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?
@Task
class MyFooTask {
@Attribute
@Validate
String foo;
@Element
@Validate(min=2)
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
lowercase
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
required
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
1.2-compatibility.
Jan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]