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
I think with the committed change your example would result in PresentSelector present = new PresentSelector(); present.setTargetdir(file); present.setPresent( EnumeratedAttribute.getInstance(PresentSelector.FilePresence.class, "both") ); none.appendSelector(present); Jan