Define method that must validate to true and put the @AssertTrue
annotation on the top of it:
@AssertTrue
private boolean isOk() {
return someField != something || otherField != null;
}
The method must start with ‘is’.
More Related Contents:
- Is there an implementation of JSR-303 (bean validation) available?
- Unique constraint with JPA and Bean Validation
- JSR303 custom validators being called twice
- Autowired Repository is Null in Custom Constraint Validator
- Specific String validation using regex
- How to sanity check a date in Java
- How to use Scanner to accept only valid int as input
- How to validate an XML file against an XSD file?
- Struts2 INPUT result: how does it work? How are conversion / validation errors handled?
- How can I check if a single character appears in a string?
- Validating URL in Java
- How to check whether a given string is valid JSON in Java
- How to validate an XML file using Java with an XSD having an include?
- Validate JAXBElement in JPA/JAX-RS Web Service
- Is there a way in Java to determine if a path is valid without attempting to create a file?
- Spring Web MVC – validate individual request params
- Annotations from javax.validation.constraints not working
- Spring @Validated in service layer
- Validating XML against XSD [duplicate]
- How do I validate incoming JSON data inside a REST service?
- Struts Web Application: Reusable Validation Client-Side & Server-Side
- javax.validation.ValidationException: HV000183: Unable to load ‘javax.el.ExpressionFactory’
- Manually call Spring Annotation Validation
- Autowired gives Null value in Custom Constraint validator
- XML syntax validation in Java [closed]
- Spring-Boot How to properly inject javax.validation.Validator
- Regex date validation for yyyy-mm-dd [duplicate]
- JSF 2 – Bean Validation: validation failed -> empty values are replaced with last valid values from managed bean
- Check Credit Card Validity using Luhn Algorithm
- Exclude directories & subdirectories from validation in Eclipse