Refactoring EJB 3.x Java elements

Using workspace refactoring operations, you can quickly and safely rename code artifacts globally across your application. The workspace recognizes EJB 3.x applications and manages changes to relevant annotations and deployment descriptors.

Procedure

  1. In the Enterprise Explorer view, the Outline view, or the Java™ editor, right-click the field or method you want to rename and select Refactor. From the submenu that follows, select Rename. The Rename Field or Rename Method panel opens.
  2. Enter the new name for the field or method and click Next.
  3. Review each change to be performed. If you do not want to make a particular change, clear the box next to the change. Click Finish.

What to do next

The operation makes changes to the Java artifacts that reference the field or method that you rename. If the field or method is annotated with a dependency injection annotation (@EJB, @Inject, or @Resource), the refactoring operation also updates the XML artifacts that make reference to the field or method.

Additionally, by selecting Java EE Tools > Promote Method from the context menu of a method, you can move the method to the business interface for the EJB. If a bean class specifies its business interfaces using annotations or the EJB deployment descriptor, you can still specify the business interface as the target of the operation. A Refactor > Move operation moves a field or method from one package to another.

Icon that indicates the type of topic Task topic
Timestamp icon Last updated: July 17, 2017 21:58

File name: trefactorejb3.html