O'Reilly logo

Spring Roo 1.1 Cookbook by Ashish Sarin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding attributes to a Java class

You can add attributes to your Java classes in your Roo project, either from your IDE or by using the field commands of Spring Roo. There are advantages in adding attributes using Roo as opposed to using an IDE, which we will see in this recipe. The following table shows the name and type of attributes that we will add to a Passenger class in the package sample.roo.flightapp.domain of the flight-app project:

Field name

Type

firstName

java.lang.String

lastName

java.lang.String

age

java.lang.Integer

address

sample.roo.flightapp.domain.Address

Getting ready

Start the Roo shell from the C:\roo-cookbook\ch01-recipe directory, which contains the flight-app project.

How to do it...

Roo provides ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required