Java Reference
In-Depth Information
}
}
After youcreate your validator, you must register the service (see Chapter 7 , Annota-
tions and CDI ). Then, import the package containing your annotation. The following
screenshot shows the structure of the project in which we have defined our annota-
tion:
Now, we just need to add @Case (type = CaseType.UPPER) on an attribute of
type String to ensure that the value will always be in capital letters. The following
code shows the change in the InscriptionBean Bean code that was presented
earlier:
@Case(type= CaseType.UPPER, message="This value
must be uppercase")
private String gender;
And the result is simply beautiful, as shown in the following screenshot:
Search WWH ::




Custom Search