> From: Jose Alberto Fernandez [mailto:[EMAIL PROTECTED]
>
> 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.
Adam
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>