Hi, > Modified: src/main/org/apache/tools/ant IntrospectionHelper.java > Added: src/main/org/apache/tools/ant/types DestDir.java > DestFile.java PreferredAttribute.java SrcDir.java > SrcFile.java ValidatedFileAttribute.java > Log: > IntrospectionHelper has been modified such that overridden setter methods > that take in 'PreferredAttribute's as argument gain higher precedence. > New attribute types - SrcDir, SrcFile, DestDir and DestFile are introduced. Each of these types is a PreferredAttribute.
Let me provide the rationale behind this commit. A lot of the tasks that we have perform one validation or another before performing the actual execution. One such validation that is commonly repeated is the check to see if a file exists, if it is a directory, or if it is a file, etc. These are the common rules that most of the tasks check: 1. Src File must exist and must be a file. 2. Src Dir must exist and must be a directory. 3. Dest File may not exist, but if it does exist, it must be a file. 4. Dest Dir may not exist, but if it does exist, it must be a directory. These new classes encapsulate this validation thereby minimizing the validation code that the task writer has to write. I have modified IntrospectionHelper such that it stays backwards compatible while at the same time takes advantage of the newly introduced 'PreferredAttribute' mechanism. I look at PreferredAttribute as a stop gap measure till Ant2 is released at which time, this may go off, as we wouldn't be backwards compatible anyway. There are a lot of tasks that currently take in File as argument to the setter methods. I will be refactoring these shortly, such that they take in ValidatedFileAttributes as arguments. The concept of validation here is somewhat similar to EnumeratedAttribute. Cheers, Magesh -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
