I have some jxpaths I want to put them in an enumeration I will be sharing with a JSF page using a map that will make them available to EL as the keys for jxpath to do a createPathAndSetValue on.
Then I can easily fill out a model without creating tons of getters and setters. like this:
<h:inputText value="#{backingBeanMap[backingBeanMap.billingAddress_postalCode]}" />
I have something like this
public enum MWField {
isGiftJoin,
billingAddress_postalCode,
...
associates$3_memberInfo_membershipType_type;
public final String xpath;
MWField(){
this.xpath = name().replace('_', '/').replace("$0", "[0]")
.replace("$1", "[1]").replace("$2", "[2]")
.replace("$3", "[3]").replace("$4", "[4]")
.replace("$5", "[5]").replace("$6", "[6]")
.replace("$7", "[7]").replace("$6", "[6]")
.replace("$9", "[9]").replace("$10", "[10]");
}
}
I use the name isGiftJoin or billingAddress_postalCode instead of uppercase names and do substitution of the _ with / in the constructor (so the xpath attribute is the actual xpath). So long as none of the properties have _ in the name (they don't), I am done. The enumerations won't be "UPPERCASE", but enumerations aren't really CONSTANTS in the sense that RED is a constant. Here they are instances of a class that point at data, and aren't intended to be "constant" in that way.
Are these names too wierd and non-standard? Is it silly to be chained to the C style constant UPPERCASE standard?