Entering content frameProcedure documentation Moving Components to the Interface Locate the document in its SAP Library structure

Use

If required, attributes, methods and events of all visibility sections of a class can be moved to an interface implemented by the class. However, the components might no longer be visible after the move since interfaces only have PUBLIC components. See also: Class Diagram.

Caution

Note that a conflict could occur if a method that you move to an interface was already redefined in a subclass. In this case the subclass must redefine another method, namely the interface method. The Assistant recognizes this situation and performs the necessary adjustments in the subclass for you.

Note

Create an alias name for each component that was moved. This prevents the users of these components from being invalidated.

Procedure

  1. Select the class and change to the Class Editor.
  2. Make sure you are in Change mode.
  3. Choose Utilities ® Refactoring Assistant.
  4. The Assistant is started in a separate window.

  5. Select the class component to be moved and move it to the name of the interface using Drag & Drop.
  6. Save using the corresponding icon.
  7. Close the Assistant.

Result

The moved class components are created in the interface. All PRIVATE and PROTECTED components are automatically assigned PUBLIC visibility. If methods with existing implementation were moved, the implementation is retained.

 

 

 

Leaving content frame