Class ConvertElementInfo

java.lang.Object
com.nomagic.magicdraw.uml.ConvertElementInfo
All Implemented Interfaces:
Comparable<ConvertElementInfo>

@OpenApiAll public class ConvertElementInfo extends Object implements 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:
  • Constructor Details

    • ConvertElementInfo

      public ConvertElementInfo(@CheckForNull String name, Class<? extends Element> elementType, @CheckForNull 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(Class<? extends Element> elementType, 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 String name, 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(Class<? extends Element> elementType)
      Constructs this info.
      Parameters:
      elementType - type to which to convert.
    • ConvertElementInfo

      public ConvertElementInfo(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 Details

    • getName

      @CheckForNull public String getName()
      Gets name of conversion.
      Returns:
      name of conversion.
    • getElementType

      public 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 Class<? extends PresentationElement> getSymbolType()
      Type of the symbol to which to convert.
      Returns:
      type of the symbol to which to convert.
    • getHumanName

      public 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:
      compareTo in interface 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 situations
      Sets preserve element ID flag value.
      Parameters:
      preserveElementID - preserve element ID flag value
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class 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 String getElementIDSuffix()
      Gets element ID suffix.
      Returns:
      element ID suffix.
    • setElementIDSuffix

      public void setElementIDSuffix(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 Collection<Stereotype> stereotypes)
      Set stereotypes to apply to converted element after conversion
      Parameters:
      stereotypes - stereotypes
    • getAdditionalStereotypes

      public 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 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(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
    • isReplaceSourcePresentationElement

      public boolean isReplaceSourcePresentationElement(PresentationElement sourcePresentationElement)
      Check if source presentation element may be replaced. Default implementation checks is symbol is readonly
      Parameters:
      sourcePresentationElement - presentation element to check
      Returns:
      true if presentation element may be replaced