Package ejava.jpa.example.validation
Class Address2
- java.lang.Object
-
- ejava.jpa.example.validation.Address2
-
@Entity @GroupSequence({Address2.class,DBChecks.class,DataChecks.class}) public class Address2 extends Object
This class provides an example of using GroupSequences where you can organize validation groups into a sequence which will short circuit once one of the groups fails. This is also an example of a class where we have overridden the Default group for the class to start with (what would normally be) the Default group and then continue to two other validations groups.
-
-
Field Summary
Fields Modifier and Type Field Description private @NotNull(message="city not supplied") @Size(max=20,message="city name too large",groups=DBChecks.class) @Pattern(regexp="^[a-zA-Z\\ ]+$",groups=DataChecks.class,message="city must be upper and lower case characters") String
city
private int
id
private @NotNull(message="state not supplied") @Size(min=2,max=2,message="state wrong size",groups=DBChecks.class) @Pattern(regexp="^[A-Z][A-Z]$",groups=DataChecks.class,message="state must be upper case letters") String
state
private @NotNull(message="street not supplied") @Size(max=32,message="street name too large",groups=DBChecks.class) @Pattern(regexp="^[0-9A-Za-z\\ ]+$",groups=DataChecks.class,message="street must be numbers and letters") String
street
private @NotNull(message="zipcode not supplied") @Size(min=5,max=5,message="zipcode wrong size",groups=DBChecks.class) @Pattern(regexp="^[0-9][0-9][0-9][0-9][0-9]$",groups=DataChecks.class,message="zipcode must be numeric digits") String
zip
-
Constructor Summary
Constructors Constructor Description Address2()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCity()
int
getId()
String
getState()
String
getStreet()
String
getZip()
Address2
setCity(String city)
Address2
setState(String state)
Address2
setStreet(String street)
Address2
setZip(String zip)
String
toString()
-
-
-
Field Detail
-
id
private int id
-
street
@NotNull(message="street not supplied") @Size(max=32, message="street name too large", groups=DBChecks.class) @Pattern(regexp="^[0-9A-Za-z\\ ]+$", groups=DataChecks.class, message="street must be numbers and letters") private @NotNull(message="street not supplied") @Size(max=32,message="street name too large",groups=DBChecks.class) @Pattern(regexp="^[0-9A-Za-z\\ ]+$",groups=DataChecks.class,message="street must be numbers and letters") String street
-
city
@NotNull(message="city not supplied") @Size(max=20, message="city name too large", groups=DBChecks.class) @Pattern(regexp="^[a-zA-Z\\ ]+$", groups=DataChecks.class, message="city must be upper and lower case characters") private @NotNull(message="city not supplied") @Size(max=20,message="city name too large",groups=DBChecks.class) @Pattern(regexp="^[a-zA-Z\\ ]+$",groups=DataChecks.class,message="city must be upper and lower case characters") String city
-
state
@NotNull(message="state not supplied") @Size(min=2, max=2, message="state wrong size", groups=DBChecks.class) @Pattern(regexp="^[A-Z][A-Z]$", groups=DataChecks.class, message="state must be upper case letters") private @NotNull(message="state not supplied") @Size(min=2,max=2,message="state wrong size",groups=DBChecks.class) @Pattern(regexp="^[A-Z][A-Z]$",groups=DataChecks.class,message="state must be upper case letters") String state
-
zip
@NotNull(message="zipcode not supplied") @Size(min=5, max=5, message="zipcode wrong size", groups=DBChecks.class) @Pattern(regexp="^[0-9][0-9][0-9][0-9][0-9]$", groups=DataChecks.class, message="zipcode must be numeric digits") private @NotNull(message="zipcode not supplied") @Size(min=5,max=5,message="zipcode wrong size",groups=DBChecks.class) @Pattern(regexp="^[0-9][0-9][0-9][0-9][0-9]$",groups=DataChecks.class,message="zipcode must be numeric digits") String zip
-
-