Class TypeSection

  • All Implemented Interfaces:
    IDescriptionPart

    public class TypeSection
    extends BslDocumentationComment.Section
    implements IDescriptionPart
    Class represents type section in Bsl documentation comment. Type section can contain some parts:
     [TypeName1, TypeName2:
         extraFieldForType2 (TypeSection for field)? (description of the field)?
     ]
     
    If user want that collection type contains special type for elements in collection - should used IBslCommentToken.CONTAINS Examle of Array that contains elements with String type
     [Array contains String]
     
    Complicated case, when Array contains some types String and Structure, and Structure has extra fields
     [Array contains String, Structure:
          fieldForStructure1
         *fieldForStructure2
     ]
     
    • Constructor Detail

      • TypeSection

        public TypeSection​(int lineNumber,
                           int offset,
                           int headerKeywordLength)
        Constructor
        Parameters:
        lineNumber - number of line from the comment begining corresponding to the start line of the section
        offset - local line offset of the begining section on the line
        headerKeywordLength - length of the keyword of the section
      • TypeSection

        public TypeSection​(int lineNumber)
        Constructor. This constructor should be used if section description created programmatically
        Parameters:
        lineNumber - number of line from the comment begining corresponding to the start line of the section
    • Method Detail

      • serialize

        public int serialize​(int currentLine,
                             boolean isRu,
                             boolean oldFormat,
                             String lineFormatter,
                             String indent,
                             int alignmentSpaces,
                             int starNumber,
                             StringBuilder builder)
        Serialize type section to the string
        Parameters:
        currentLine - actual line in Bsl documentation comment for starting write of new content
        isRu - true if need to use Russian keywords
        oldFormat - true if string presentation must be in old format, false in new format
        lineFormatter - symbols added before IBslCommentToken.LINE_STARTER for each line, cannot be null
        indent - symbols for indent extra fields, cannot be null
        alignmentSpaces - number of spaces for alignment type section in whole comment content
        starNumber - number of IBslCommentToken.STAR using before extra fields in old format
        builder - StringBuilder for append string content of the type section, cannot be null
        Returns:
        number of current line after type section serialization
      • closeSection

        public void closeSection()
        Sets that section was closed
      • isClose

        public boolean isClose()
        Checks that section was closed or not
        Returns:
        true if section is closed, false otherwise
      • hasTypeExtensionPart

        public void hasTypeExtensionPart​(boolean isExtensionPart)
        Sets that section has extra fields part
        Parameters:
        isExtensionPart - true if section has extra fields part, false otherwise
      • isExtensionPart

        public boolean isExtensionPart()
        Checks that section has extra fields part
        Returns:
        true if section has extra fields part, false otherwise
      • match

        public boolean match​(int lineNumber,
                             int offset)
        Description copied from interface: IDescriptionPart
        Checks that this description part corresponding to the concrete line number and offset
        Specified by:
        match in interface IDescriptionPart
        Parameters:
        lineNumber - number of the documentation comment line
        offset - local offset on the comment line
        Returns:
        true if this description part corresponding to the send line number and offset, false otherwise
      • getDescriptionPart

        public IDescriptionPart getDescriptionPart​(int lineNumber,
                                                   int offset)
        Gets actual documentation comment IDescriptionPart by line number and local line offset
        Parameters:
        lineNumber - number of the comment line for getting IDescriptionPart
        offset - local line offset for getting IDescriptionPart
        Returns:
        IDescriptionPart corresponding to the line number and local line offset, can be null if there is no description part on this line number and offset
      • fill

        public void fill​(List<TypeItem> typeItems,
                         String description,
                         boolean isRu)
        Fills type section with real TypeItem
        Parameters:
        typeItems - collection of the real TypeItems, cannot be null
        description - text description of the type section, cannot be null
        isRu - true if should use Russian name of the type in creating type section, false if should use English names
      • fill

        public void fill​(List<TypeItem> typeItems,
                         String description,
                         boolean isRu,
                         org.eclipse.emf.ecore.EObject context)
        Fills type section with real TypeItem
        Parameters:
        typeItems - collection of the real TypeItems, cannot be null
        description - text description of the type section, cannot be null
        isRu - true if should use Russian name of the type in creating type section, false if should use English names
        context - context EObject for resolving TypeItem from collection, can be null if resolving not needed