JBoss.orgCommunity Documentation

Chapter 6. Creation and Registration

6.1. Create and Register a Custom Converter
6.2. Create and Register a Custom Validator
6.3. Create and Register Referenced Beans

It's also possible to create a custom Converter in order to specify your own converting rules. Let's look at how you can do this.

To create and register a custom converter it's necessary to go through the following steps:


  • Select Converters and click on Add button.

  • On the form type the name of your converter in the Converter-id field and name of the class for converters. After clicking Finish button your custom converter is registered under the entered name.


  • Now you can create "converter" class. In the Converter section you should see your Converter-id and Converter-class. Click on Converter-class to generate the source code.


  • A usual wizard for creating a Java class will appear. All needed fields here will be adjusted automatically. Just leave everything without changes and click Finish.


  • To open a converter class click again on Converter-class link in the Converter section.


Now you are able to add a business logic of converter in the Java editor.

It's also quite easy to develop your own custom Validators. You should perform the actions similar to previous. Go through the following steps:


  • Select Validators and click on Add button.

  • Type the name of your validator in the Validator-id field and name of the class for validators. After clicking Finish button your custom validator is registered under the entered name.


Now you can create the "validator" class.

  • In the Validator section you can see your Validator-id and Validator-class. To generate the source code click on Validator-class.


  • Java class will be created automatically. Leave everything without changes and click Finish.


  • To open validator class click again on Validator-Class link in the Validator section. Now you are able to write a business logic of validator in the Java editor.


Creation of Referenced Beans is similar to creation of Custom Validator as well. To perform this, let's walk through the necessary steps.


  • Select Referenced Beans and click on Add button.

  • Type in the name of your Referenced Bean and type in or select Referenced-Bean-Class by using Browse button.


  • In the Referenced Bean section you should see your Referenced-Bean-Name and Referenced-Bean-Class. Click on the link to open the Java creation wizard.


  • Java class will be created automatically. Leave everything without changes and click Finish.


  • To open Referenced Bean class click again on Referenced-Bean-Class in the Referenced Bean section. Now you are able to write business logic of Referenced Bean in the Java editor.