Class Refactoring.Converting

  • Enclosing class:
    Refactoring

    @OpenApiAll
    public static class Refactoring.Converting
    extends java.lang.Object
    Converts elements in the model.
    • Constructor Detail

      • Converting

        public Converting()
    • Method Detail

      • convert

        public static Element convert​(Element source,
                                      ConvertElementInfo info)
                               throws ReadOnlyElementException
        Converts given element according given conversion info.
        Parameters:
        source - element to convert.
        info - conversion rules.
        Returns:
        newly created element after conversion, null if conversion didn't succeed.
        Throws:
        ReadOnlyElementException - if given element is not editable (read-only).
      • convert

        public static Element convert​(Element source,
                                      @CheckForNull
                                      Element target,
                                      ConvertElementInfo info)
                               throws ReadOnlyElementException
        Converts element with another element according given conversion info.
        Parameters:
        source - element to convert.
        target - element with which to convert, can be null, in this case a new element will be created.
        info - conversion rules.
        Returns:
        target element.
        Throws:
        ReadOnlyElementException - if given element is not editable (read-only).
      • convert

        private static Element convert​(Element source,
                                       @CheckForNull
                                       Element target,
                                       ConvertElementInfo info,
                                       boolean checkReadOnly,
                                       boolean addDisposeValidator)
                                throws ReadOnlyElementException
        Converts element with another element according given conversion info.
        Parameters:
        source - element to convert.
        target - element with which to convert, can be null, in this case a new element will be created.
        info - conversion rules.
        checkReadOnly - indicates if source and target should be checked for editing permissions.
        addDisposeValidator - indicates if source disposal should be verified.
        Returns:
        target element.
        Throws:
        ReadOnlyElementException - if given element is not editable (read-only).
      • convertNoteToComment

        public static ShapeElement convertNoteToComment​(ShapeElement note,
                                                        @CheckForNull
                                                        Stereotype commentStereotype)
                                                 throws ReadOnlyElementException
        Converts Note into Comment.
        Parameters:
        note - note shape
        commentStereotype - apply given stereotypes to created Comment
        Returns:
        Comment shape
        Throws:
        ReadOnlyElementException - if given Note symbol is not editable (read-only) or diagram owner is not editable
        java.lang.IllegalArgumentException - if given symbol is not a Note symbol
      • convertCommentToNote

        public static ShapeElement convertCommentToNote​(ShapeElement comment)
                                                 throws ReadOnlyElementException
        Converts Comment into Note.
        Parameters:
        comment - comment shape
        Returns:
        Note shape
        Throws:
        ReadOnlyElementException - if given Comment symbol is not editable (read-only) or Comment is not editable
        java.lang.IllegalArgumentException - if given symbol is not a Comment symbol