Class 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 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
    • Constructor Detail

      • Address2

        public Address2()