The pull-out refactoring is the reverse of push-in refactoring. In push-out refactoring you extract methods and attributes from the Java source file and move it to an AspectJ ITD file. This feature is particularly useful in the following situations:
toString
method from the Flight.java
file to Flight_To_String.aj
file.Follow the instructions specified in the Removing Roo with push-in refactoring recipe to push the toString
method defined in the Flight_To_String.aj
file to Flight.java
file.
Follow these steps to move the code from Java source file to an AspectJ ITD file:
Flight_To_String.aj
file in the sample.roo.flightapp.domain
package, as shown here:package sample.roo.flightapp.domain; public aspect Flight_To_String { }
This an empty aspect into which we want to pull-out fields, contructors, methods, and so on, from Java source file.
Flight.java
file in Eclipse IDE.toString
method should be added:In the preceding screenshot enter sample.roo.flightapp.domain.Flight_To_String
as the name of the Target Aspect and make sure that you check the Make the Aspect Privileged option.
toString
method to the Flight_To_String.aj
file.IIf you want to use Spring Roo for an existing project, then you need to move the methods, attributes or constructors from Java source files to AspectJ ITD files. These ITD files are then managed by Spring Roo. You need to make sure that you only move those Java elements to AspectJ ITD files that can be managed by Roo. The naming convention followed by these AspectJ ITD files should follow the naming convention expected by Roo. You'll also have to add necessary Roo-related dependencies in your pom.xml file.
3.143.17.27