--- Rhino <[EMAIL PROTECTED]> wrote: > ----- Original Message ----- > From: "Matt Benson" <[EMAIL PROTECTED]> > > --- Rhino <[EMAIL PROTECTED]> wrote: [SNIP] > >> other types) but the > >> constant I am trying to read is defined as > follows: > >> > >> public static final EmploymentHistoryFormats > >> DESIRED_EMPLOYMENT_HISTORY_FORMAT = > >> EmploymentHistoryFormats.LIST_FORMAT; > >> > >> EmploymentHistoryFormats is an enum, not a > String. > >> > >> Is there any way to coax this filter to tell me > that > >> the current value of > >> DESIRED_EMPLOYMENT_HISTORY_FORMAT is LIST_FORMAT? > >> That's all I really want > >> to know to get my build.xml working 100%. > >> > >> If not, is there any other way to get this > >> information? > > > > filter the Java file w/ regex looking for > > > > "^[\s]*public static final > EmploymentHistoryFormats > > > DESIRED_EMPLOYMENT_HISTORY_FORMAT[\s]*=[\s]*([^;]+);[\s]*$" > > > > and replace w/ "\1"? > > > Your suggestion is a bit cryptic for me to follow > completely. Are you saying > I should use a ContainsRegex filter but still within > LoadProperties? Or are > you proposing that I use LoadFiles and the .java > file instead of the > ClassConstants filter?
Basically you want to display the value to the user, right? Then just use <loadfile> with a <containsregex flags="m"> filter... the regex I supplied above included a parenthetically-delimited "group" (I believe is the term in regex parlance) that included the value. When you specify "\1" as the replacement, only the portion of the input data that matched the first (\1) group in the regex will come through the filter. You could also move the parentheses forward to pull the name of the constant as well, and save yourself a little more typing in the buildfile. But you may want to give that as "Desired Employment History Format", who knows? The end result is that you can load just that value (e.g. FOO) or D_E_H_F=FOO in a property, which you can then display to the user as an <input> prompt or whatever. -Matt > > And why do you want to replace anything? I just want > to know the value of > the constant, not change it. (Although, now that I > think about it, it might > be neat to be able to let the user modify the value > before doing the rest of > the build.... But I don't think that's what you're > talking about, right? > > -- > Rhino [SNIP] __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
