-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Spring Roo 1.1 Cookbook
You can use Spring Roo's interface command or an IDE to create a Java interface. In this recipe, we will see how we can create an interface named FlightServiceIntf.
Start the Roo shell from the C:\roo-cookbook\ch01-recipe directory, which contains the flight-app Roo project.
Spring Roo provides the interface command to create a Java interface, as shown here:
roo> interface --class sample.roo.flightapp.service.FlightServiceIntf Created SRC_MAIN_JAVA\sample\roo\flightapp\service\FlightServiceIntf.java sample.roo.flightapp.service.FlightServiceIntf roo>
The following table describes the arguments that the interface command accepts:
|
Argument |
Purpose |
|---|---|
|
|
It is a mandatory argument, which specifies the fully-qualified name of the Java interface. |
|
|
It is an optional argument, which identifies the directory in which to create the interface, default being |
|
|
It is an optional argument, which instructs Spring Roo to allow reserved words in the name of Java interface. |
Using Spring Roo you can't add constants or declare methods in your Java interface. To add constants or methods, you need to use your IDE. You may have noticed that the rooAnnotations argument is not available for the interface command; therefore, you can safely assume that Spring Roo doesn't generate any code corresponding to a Java interface when you make modifications to it.
The Creating a Java class recipe shows how to create a Java class using Spring Roo
Change the font size
Change margin width
Change background colour