DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14831>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14831 EnumeratedAttributes are not developer friendly Summary: EnumeratedAttributes are not developer friendly Product: Ant Version: 1.5.1 Platform: All OS/Version: Other Status: NEW Severity: Enhancement Priority: Other Component: Core AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] The code below illustrates the 3 lines of code necessary to set an enum attrib programmatically. I find it heavy... PresentSelector present = new PresentSelector(); present.setTargetdir(file); // 1) Instantiate enum attrib PresentSelector.FilePresence both = new PresentSelector.FilePresence(); // 2) Set value of enum attrib both.setValue("both"); // 3) Set enum attrib present.setPresent(both); none.appendSelector(present); I propose 3 different things: 1) Adding a protected EnumeratedAttribute(String value) Ctor 2) Adding EnumClass(String value) { super(value); } Ctor to the various enums. 2') Prebuilt declare the various enum values, like in public class PresentSelector extends BaseSelector { public static class FilePresence extends EnumeratedAttribute { public static final FilePresence BOTH = new FilePresence("both"); public static final FilePresence SRCONLY = new FilePresence("srconly"); private FilePresence(String value) { super(value); } public String[] getValues() { return new String[] {SRCONLY.getValue(), BOTH.getValue()}; } } } My example then becomes: PresentSelector present = new PresentSelector(); present.setTargetdir(file); present.setPresent(PresentSelector.FilePresence.BOTH); none.appendSelector(present); As an aside, I personnally think that although the Bean pattern is generic and fine, I'd rather be able to write programmatically: none.appendSelector(new PresentSelector(file, PresentSelector.FilePresence.BOTH)); Thanks, --DD -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
