@OpenApiAll
public class Refactoring
extends java.lang.Object
To refactor an element in a model, use the Refactoring
class.
Element elementToConvert = ...; SessionManager sessionManager = SessionManager.getInstance(); sessionManager.createSession("Convert"); // Converts the element to an interface. ConvertElementInfo info = new ConvertElementInfo(Interface.class); // Preserves the old element ID for the new element. info.setPreserveElementID(true); Element conversionTarget = Refactoring.Converting.convert(elementToConvert, info); sessionManager.closeSession();
Element elementToReplace = ...; SessionManager sessionManager = SessionManager.getInstance(); sessionManager.createSession("Replace"); ConvertElementInfo info = new ConvertElementInfo(elementToReplace.getClassType()); info.setConvertOnlyIncomingReferences(true); Refactoring.Replacing.replace(element, elementToReplace, info); sessionManager.closeSession();
ConvertElementInfo
,
Element
,
SessionManager
Modifier and Type | Class and Description |
---|---|
static class |
Refactoring.Converting
Converts elements in the model.
|
static class |
Refactoring.Extracting
Extracts part of the model into a new reusable piece of model.
|
static class |
Refactoring.Moving
Moves elements in model to a new owner element with or without connected relations
An example how to move elements together with their relations:
|
static class |
Refactoring.RelationReconnecting
Reconnects one relation so that it skips selected part of the model.
|
static class |
Refactoring.RelationReversing
Reverses direction of a relationship.
|
static class |
Refactoring.Replacing
Replaces elements in the model.
|
Constructor and Description |
---|
Refactoring() |