img
Then you will able to see all the classes in the Package Explorer, as shown in Figure 20-16.
Figure 20-16. Spring Roo­generated classes
The AspectJ classes (*.aj files) that Roo generated are AspectJ intertype declarations (ITD) classes.
These ITDs are the magic behind Spring Roo and store all the logic generated and maintained by Roo.
For example, the ITDs will store the getter/setter methods, common properties for JPA (for example, the
ID, version, and so on), the toString() method, and so on.
At this point, when you take a look at the Roo Shell view, you will see that the shell is "focused" on
the Contact class, as shown in Figure 20-17.
Figure 20-17. Roo Shell focus
In Roo, focus means that all the subsequent class-level commands will be applied to the class that
currently has the focus. The next step is to define the properties for the Contact class. We will need to
create three properties, namely, firstName, lastName, and birthDate. To do this, enter the following
commands one by one:
field string --fieldName firstName --notNull --sizeMin 3 --sizeMax 60
field string --fieldName lastName --notNull --sizeMin 1 --sizeMax 40
field date --fieldName birthDate --type java.util.Date
In the above commands, the field command is used to define the fields for the Contact class.
Because we already focusing on the Contact class, we don't need to provide the class name. The
attribute after the field is the type, and then the field name and the JSR-303 constraints for the fields
appear.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home