Package com.nomagic.magicdraw.uml
Class ConvertElementInfo
- java.lang.Object
-
- com.nomagic.magicdraw.uml.ConvertElementInfo
-
- All Implemented Interfaces:
java.lang.Comparable<ConvertElementInfo>
@OpenApiAll public class ConvertElementInfo extends java.lang.Object implements java.lang.Comparable<ConvertElementInfo>
Holds information which controls the process of element conversion, for example allows to define target element type and preferred symbol type.- See Also:
Refactoring,Element,PresentationElement
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceConvertElementInfo.DisposeSourceValidatorValidates whether source should be disposed after conversion.
-
Constructor Summary
Constructors Constructor Description ConvertElementInfo(java.lang.Class<? extends Element> elementType)Constructs this info.ConvertElementInfo(java.lang.Class<? extends Element> elementType, boolean canInfoBeLost)Constructs this info.ConvertElementInfo(java.lang.Class<? extends Element> elementType, java.lang.Class<? extends PresentationElement> symbolType)Constructs this info.ConvertElementInfo(java.lang.String name, java.lang.Class<? extends Element> elementType, boolean createSymbol)Constructs this info.ConvertElementInfo(java.lang.String name, java.lang.Class<? extends Element> elementType, java.lang.Class<? extends PresentationElement> symbolType)Constructs this info.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancanChangeElement(Element element)Indicates if element can be changed by conversion.booleancanConvert(Element element)Indicates if element can be converted.booleancanInfoBeLost(Element source)Indicates if info can be lost for a given source element.intcompareTo(ConvertElementInfo o)booleanequals(java.lang.Object o)java.util.Collection<Stereotype>getAdditionalStereotypes()ConvertElementInfoCategorygetCategory()ConvertElementInfo.DisposeSourceValidatorgetDisposeSourceValidator()Gets dispose source validator.java.lang.StringgetElementIDSuffix()Gets element ID suffix.java.lang.Class<? extends Element>getElementType()Gets type of the element to which to convert.java.lang.StringgetHumanName()Gets human-readable format of the conversion.java.lang.StringgetName()Gets name of conversion.java.util.Map<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject>getPendingMapping()java.lang.Class<? extends PresentationElement>getSymbolType()Type of the symbol to which to convert.inthashCode()booleanisCanChangeElementName()Gets can change element name flag value.booleanisConvertingSourceEditable(Element source)Indicates if source element is editablebooleanisConvertOnlyIncomingReferences()Gets convert only incoming references flag value.booleanisConvertRelatedElements()booleanisCreateSymbol()Gets create symbol flag value.booleanisDisposeSource()Indicates if source should be disposed after conversion.booleanisPreserveElementID()Gets preserve element ID flag value.booleanisRemoveFromCollections()If the method returns true then convert should remove a value from the source element collection.voidsetAdditionalStereotypes(java.util.Collection<Stereotype> stereotypes)Set stereotypes to apply to converted element after conversionvoidsetCanChangeElementName(boolean canChangeElementName)Sets can change element name flag value.voidsetCanInfoBeLost(boolean canInfoBeLost)Sets info can be lost flag value.voidsetCategory(ConvertElementInfoCategory category)Set category of info used for grouping of targets in UI.voidsetConvertOnlyIncomingReferences(boolean convertOnlyIncomingReferences)Sets convert only incoming references flag value.voidsetConvertRelatedElements(boolean convertRelatedElements)Set flag for related elements convertingvoidsetCreateSymbol(boolean createSymbol)Sets create symbol flag value.voidsetDisposeSourceValidator(ConvertElementInfo.DisposeSourceValidator disposeSourceValidator)Sets dispose source validator.voidsetElementIDSuffix(java.lang.String elementIDSuffix)Sets element ID suffix.voidsetPendingMapping(java.util.Map<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> pendingMapping)Sets mapping for elements which will be converted latervoidsetPreserveElementID(boolean preserveElementID)Deprecated.it is not recommended to use this setting as preserving ids can break model consistency if some situations
-
-
-
Constructor Detail
-
ConvertElementInfo
public ConvertElementInfo(@CheckForNull java.lang.String name, java.lang.Class<? extends Element> elementType, @CheckForNull java.lang.Class<? extends PresentationElement> symbolType)Constructs this info.- Parameters:
name- name of conversion.elementType- type to which to convert.symbolType- preferred symbol type to which to convert.
-
ConvertElementInfo
public ConvertElementInfo(java.lang.Class<? extends Element> elementType, java.lang.Class<? extends PresentationElement> symbolType)
Constructs this info.- Parameters:
elementType- type to which to convert.symbolType- preferred symbol type to which to convert.
-
ConvertElementInfo
public ConvertElementInfo(@CheckForNull java.lang.String name, java.lang.Class<? extends Element> elementType, boolean createSymbol)Constructs this info.- Parameters:
name- name of conversion.elementType- type to which to convert.createSymbol- indicates if symbol should be created with this conversion.
-
ConvertElementInfo
public ConvertElementInfo(java.lang.Class<? extends Element> elementType)
Constructs this info.- Parameters:
elementType- type to which to convert.
-
ConvertElementInfo
public ConvertElementInfo(java.lang.Class<? extends Element> elementType, boolean canInfoBeLost)
Constructs this info.- Parameters:
elementType- type to which to convert.canInfoBeLost- indicates if info can be lost by conversion.
-
-
Method Detail
-
getName
@CheckForNull public java.lang.String getName()
Gets name of conversion.- Returns:
- name of conversion.
-
getElementType
public java.lang.Class<? extends Element> getElementType()
Gets type of the element to which to convert.- Returns:
- type of the element to which to convert.
-
getSymbolType
@CheckForNull public java.lang.Class<? extends PresentationElement> getSymbolType()
Type of the symbol to which to convert.- Returns:
- type of the symbol to which to convert.
-
getHumanName
public java.lang.String getHumanName()
Gets human-readable format of the conversion.- Returns:
- human-readable format of the conversion.
-
compareTo
public int compareTo(@Nonnull ConvertElementInfo o)- Specified by:
compareToin interfacejava.lang.Comparable<ConvertElementInfo>
-
isCreateSymbol
public boolean isCreateSymbol()
Gets create symbol flag value.- Returns:
- create symbol flag value.
-
setCreateSymbol
public void setCreateSymbol(boolean createSymbol)
Sets create symbol flag value.- Parameters:
createSymbol- create symbol flag value.
-
canInfoBeLost
public boolean canInfoBeLost(Element source)
Indicates if info can be lost for a given source element.- Parameters:
source- element being converted.- Returns:
- true if info can be lost, false otherwise.
-
setCanInfoBeLost
public void setCanInfoBeLost(boolean canInfoBeLost)
Sets info can be lost flag value.- Parameters:
canInfoBeLost- info can be lost flag value.
-
canConvert
public boolean canConvert(Element element)
Indicates if element can be converted.- Parameters:
element- element to convert.- Returns:
- true if element can be converted, false otherwise.
-
isConvertingSourceEditable
public boolean isConvertingSourceEditable(Element source)
Indicates if source element is editable- Parameters:
source- source to convert- Returns:
- true if element is editable and can be converted, false otherwise.
-
isConvertOnlyIncomingReferences
public boolean isConvertOnlyIncomingReferences()
Gets convert only incoming references flag value.- Returns:
- convert only incoming references flag value.
-
setConvertOnlyIncomingReferences
public void setConvertOnlyIncomingReferences(boolean convertOnlyIncomingReferences)
Sets convert only incoming references flag value.- Parameters:
convertOnlyIncomingReferences- convert only incoming references flag value.
-
isDisposeSource
public boolean isDisposeSource()
Indicates if source should be disposed after conversion.- Returns:
- true if source should be disposed, false otherwise.
-
isCanChangeElementName
public boolean isCanChangeElementName()
Gets can change element name flag value.- Returns:
- can change element name flag value.
-
setCanChangeElementName
public void setCanChangeElementName(boolean canChangeElementName)
Sets can change element name flag value.- Parameters:
canChangeElementName- can change element name flag value.
-
canChangeElement
public boolean canChangeElement(Element element)
Indicates if element can be changed by conversion.- Parameters:
element- element being converted.- Returns:
- true if element can be changed by conversion.
-
isPreserveElementID
public boolean isPreserveElementID()
Gets preserve element ID flag value.- Returns:
- preserve element ID flag value
-
setPreserveElementID
@Deprecated public void setPreserveElementID(boolean preserveElementID)
Deprecated.it is not recommended to use this setting as preserving ids can break model consistency if some situationsSets preserve element ID flag value.- Parameters:
preserveElementID- preserve element ID flag value
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getCategory
public ConvertElementInfoCategory getCategory()
- Returns:
- category of info used for grouping
-
setCategory
public void setCategory(ConvertElementInfoCategory category)
Set category of info used for grouping of targets in UI.- Parameters:
category- category
-
getElementIDSuffix
public java.lang.String getElementIDSuffix()
Gets element ID suffix.- Returns:
- element ID suffix.
-
setElementIDSuffix
public void setElementIDSuffix(java.lang.String elementIDSuffix)
Sets element ID suffix.- Parameters:
elementIDSuffix- suffix to set.
-
isRemoveFromCollections
public boolean isRemoveFromCollections()
If the method returns true then convert should remove a value from the source element collection. Default implementation does not remove the collections.- Returns:
- false.
-
setAdditionalStereotypes
public void setAdditionalStereotypes(@Nonnull java.util.Collection<Stereotype> stereotypes)Set stereotypes to apply to converted element after conversion- Parameters:
stereotypes- stereotypes
-
getAdditionalStereotypes
public java.util.Collection<Stereotype> getAdditionalStereotypes()
- Returns:
- some stereotypes to apply to converted element after conversion
-
getDisposeSourceValidator
public ConvertElementInfo.DisposeSourceValidator getDisposeSourceValidator()
Gets dispose source validator.- Returns:
- dispose source validator.
-
setDisposeSourceValidator
public void setDisposeSourceValidator(ConvertElementInfo.DisposeSourceValidator disposeSourceValidator)
Sets dispose source validator.- Parameters:
disposeSourceValidator- dispose source validator to set.
-
isConvertRelatedElements
public boolean isConvertRelatedElements()
- Returns:
- true if related elements should be converted also. Default is true
-
setConvertRelatedElements
public void setConvertRelatedElements(boolean convertRelatedElements)
Set flag for related elements converting- Parameters:
convertRelatedElements- convert related elements
-
getPendingMapping
@CheckForNull public java.util.Map<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> getPendingMapping()
- Returns:
- mapping for other elements that will be converted later
-
setPendingMapping
public void setPendingMapping(java.util.Map<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject> pendingMapping)
Sets mapping for elements which will be converted later- Parameters:
pendingMapping- mapping of elements will be done later
-
-