Package com.nomagic.magicdraw.uml
Class Refactoring.Replacing
- java.lang.Object
-
- com.nomagic.magicdraw.uml.Refactoring.Replacing
-
- Enclosing class:
- Refactoring
@OpenApiAll public static class Refactoring.Replacing extends java.lang.Object
Replaces elements in the model.
-
-
Constructor Summary
Constructors Constructor Description Replacing()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Element
replace(Element elementToReplace, Element elementToReplaceWith, ConvertElementInfo info)
Replaces an element with another element.static void
replacePropertyType(Property property, EncapsulatedClassifier newClassifier, AutomaticElementMappingRule mappingRule, java.util.Map<java.util.List<Element>,java.util.List<Element>> manuallyMappedPorts)
Replaces type of the property.static void
replacePropertyType(Property property, EncapsulatedClassifier newClassifier, java.util.Map<java.util.List<Element>,java.util.List<Element>> manuallyMappedPorts)
Replaces type of the property.
-
-
-
Method Detail
-
replace
public static Element replace(Element elementToReplace, Element elementToReplaceWith, ConvertElementInfo info) throws ReadOnlyElementException
Replaces an element with another element.- Parameters:
elementToReplace
- element to replace.elementToReplaceWith
- element with which to replace.info
- conversion rules.- Returns:
- element with which element was replaced.
- Throws:
ReadOnlyElementException
- if given element is not editable (read-only).
-
replacePropertyType
public static void replacePropertyType(Property property, EncapsulatedClassifier newClassifier, @CheckForNull java.util.Map<java.util.List<Element>,java.util.List<Element>> manuallyMappedPorts)
Replaces type of the property. In case old and new property types owns ports, replaces old ports with new type ones and reconnects connectors, that where connected to the old ports. This way content of Composite Structure diagrams is not lost when property type is replaced. This method tries to map ports automatically using some default rules (basically maps ports with same name and type, or compatible interfaces)- Parameters:
property
- Property with type that owns ports.newClassifier
- new EncapsulatedClassifier to become the type of the propertymanuallyMappedPorts
- map of manually selected ports to map. Keys of this map are old type ports, and values are new type ports. Ports are stored in lists, to describe full nested structure of nested ports. If port is not nested, than list contains only one element. Else, list is full path of ports starting with the port that is directly on property's old type. Note: if some source port was mapped automatically, but also provided in this map, then mapping value from this map will be used.
-
replacePropertyType
public static void replacePropertyType(Property property, EncapsulatedClassifier newClassifier, AutomaticElementMappingRule mappingRule, @CheckForNull java.util.Map<java.util.List<Element>,java.util.List<Element>> manuallyMappedPorts)
Replaces type of the property. In case old and new property types owns ports, replaces old ports with new type ones and reconnects connectors, that where connected to the old ports. This way content of Composite Structure diagrams is not lost when property type is replaced.- Parameters:
property
- Property with type that owns ports.newClassifier
- new EncapsulatedClassifier to become the type of the propertymappingRule
-AutomaticElementMappingRule
describing how each old (source) port can be replaced with one of new (target) ports.manuallyMappedPorts
- map of manually selected ports to map. Keys of this map are old type ports, and values are new type ports. Ports are stored in lists, to describe full nested structure of nested ports. If port is not nested, than list contains only one element. Else, list is full path of ports starting with the port that is directly on property's old type. Note: if some source port was mapped using mappingRule, but also provided in this map, then mapping value from this map will be used.
-
-