This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Escape Dollar Sign in Valang

I have a form command object with a property named mail$from. Just in case some of you are thinking of it, nevermind that the property has a dollar sign in it. This is legal Java.

Anyway, the following code declares this property:

Code:

@Email(message="The mail from address must be a valid email address", applyIf="mail$from HAS LENGTH")
private String mail$from;

When I attempt to validate this, I get the following error:

Code:

org.springmodules.validation.valang.parser.TokenMgrError: Lexical error at line 1, column 5. Encountered: "$" (36), after : ""
at org.springmodules.validation.valang.parser.ValangParserTokenManager.getNextToken(ValangParserTokenManager.java:2649)
at org.springmodules.validation.valang.parser.ValangParser.jj_scan_token(ValangParser.java:1684)
at org.springmodules.validation.valang.parser.ValangParser.jj_3_4(ValangParser.java:1245)
at org.springmodules.validation.valang.parser.ValangParser.jj_2_4(ValangParser.java:946)
at org.springmodules.validation.valang.parser.ValangParser.function(ValangParser.java:515)
at org.springmodules.validation.valang.parser.ValangParser.multiplicativeExpr(ValangParser.java:643)
at org.springmodules.validation.valang.parser.ValangParser.subtractiveExpr(ValangParser.java:615)
at org.springmodules.validation.valang.parser.ValangParser.additiveExpr(ValangParser.java:587)
at org.springmodules.validation.valang.parser.ValangParser.predicate(ValangParser.java:348)
at org.springmodules.validation.valang.parser.ValangParser.expression(ValangParser.java:324)
at org.springmodules.validation.valang.parser.ValangParser.predicates(ValangParser.java:262)
at org.springmodules.validation.valang.parser.ValangParser.parseExpression(ValangParser.java:154)
at org.springmodules.validation.util.cel.valang.ValangConditionExpressionParser.parse(ValangConditionExpressionParser.java:35)
at org.springmodules.validation.bean.conf.loader.annotation.handler.AbstractPropertyValidationAnnotationHandler.extractApplicabilityContidion(AbstractPropertyValidationAnnotationHandler.java:197)
at org.springmodules.validation.bean.conf.loader.annotation.handler.AbstractPropertyValidationAnnotationHandler.handleAnnotation(AbstractPropertyValidationAnnotationHandler.java:121)
at org.springmodules.validation.bean.conf.loader.annotation.AnnotationBeanValidationConfigurationLoader.handleProprtyAnnotations(AnnotationBeanValidationConfigurationLoader.java:281)
at org.springmodules.validation.bean.conf.loader.annotation.AnnotationBeanValidationConfigurationLoader.handlePropertyAnnotations(AnnotationBeanValidationConfigurationLoader.java:238)
at org.springmodules.validation.bean.conf.loader.annotation.AnnotationBeanValidationConfigurationLoader.createValidationConfiguration(AnnotationBeanValidationConfigurationLoader.java:165)
at org.springmodules.validation.bean.conf.loader.annotation.AnnotationBeanValidationConfigurationLoader.loadConfiguration(AnnotationBeanValidationConfigurationLoader.java:105)
at org.springmodules.validation.bean.BeanValidator.validateObjectGraphConstraints(BeanValidator.java:174)
at org.springmodules.validation.bean.BeanValidator.validate(BeanValidator.java:99)

I have tried escaping the dollar sign with single quotes ("'$" and "'$'"), double quotes ('"$', '"$"'), back-slashes ("\\$"), double back-slashes ("\\\\$"), and extra dollar signs ("$$"). These all only cause different lexical errors. I've looked everywhere online, searched through these forums, searched Google, etc., to no avail.

So, how are you supposed to escape a dollar sign in a Valang expression within an expression field in a Spring Modules validation annotation parameter?