ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Murdoch" <>
Subject RE: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/types
Date Sun, 06 Jan 2002 04:38:30 GMT

> From: Jose Alberto Fernandez []
> I think the basic high level validations are:
>     mustbeSrcDir()
>     mustbeDestDir()
>     mustbeSrcFile()
>     mustbeDestFile()

These would be an ideal way to expose validation for use in a task
descriptor.  For example:

public class MyTask extends AbstractTask
   * @ant.precondition srcdir
  public void setSomeSourceDir(FileObject file) { ... }


When configuring the task, the container would enforce this precondition by
calling file.mustbeSrcDir() via introspection.  Or file.isSrcDir().

> An additional reason why I have problems with your approach is that
> it assumes that parameters must be valid at the time the attribute is set,
> and not when they are actually used (execute). Although the two events
> may occur at close time for most tasks, this may not be the case for
> always, like for example in the case of a DataType.
> For datatypes, you may have the declaration operation ( when the
> attributes
> are set) happening quite early in the build process, while the
> actual usage of the
> datatype by some task may occur much later. in such cases we may want to
> wait for the validation to occur when the reference is used.

Particularly when the same datatype object is used by more than one task, in
different roles - like the dest dir of <javac> and the src dir of <jar>.
Granted, we don't share file objects by reference (not yet, at least), but
you get the idea.


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

View raw message