Is there a library which allows to do AOP based string validation in Java. Something like this:
@StringValidate("some_regex_pattern")
String sample;
and preferably at compile time
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Did you look at any of the JSR-303 implementations or the https://java.net/jira/browse/JAVAEE_SPEC-20 6 docs?
You’d want the
@Patternannotation.I don’t understand the “at compile time”, since that seems a bit useless, and wouldn’t really be AOP IMO which is usually a runtime, byte-code manipulation thing. There’s SpringContracts, which is obviously Spring, and a few AspectJ-based libraries (although it’s not that difficult to roll your own).