Class BslDocCommentSerializer

java.lang.Object
com._1c.g5.v8.dt.bsl.documentation.comment.BslDocCommentSerializer

public class BslDocCommentSerializer extends Object
Bsl Documentation comment model serializer. Allows to serialize comment to the string with new or old format, set up some formatting style.
  • Constructor Details

    • BslDocCommentSerializer

      public BslDocCommentSerializer()
      Instantiates a new bsl doc comment serializer with defaul section space = 2 and ignoring line numbers in the model.
  • Method Details

    • newBuilder

      public static final BslDocCommentSerializer.Builder newBuilder()
      Creates new Bsl comment BslDocCommentSerializer builder.
      Returns:
      the documentation comment serializer builder
    • getSectionSpace

      public int getSectionSpace()
      Gets the line numbers of space between sections. Default is 2.
      Returns:
      the section space
    • setSectionSpace

      public void setSectionSpace(int sectionSpace)
      Sets the line numbers of space between sections. Default is 2.
      Parameters:
      sectionSpace - the new section space
    • isIgnoreLineNumbers

      public boolean isIgnoreLineNumbers()
      Checks if serializer ignores line numbers in model objects.
      Returns:
      true, if serializer is ignoring line numbers
    • setIgnoreLineNumbers

      public void setIgnoreLineNumbers(boolean ignoreLineNumbers)
      Sets serializer to ignore line numbers in model objects.
      Parameters:
      ignoreLineNumbers - the new ignore line numbers
    • isRussian

      public boolean isRussian()
      Checks if need to use Russian keywords.
      Returns:
      true, if need to use russian keywords.
    • setRussian

      public void setRussian(boolean isRu)
      Sets serialiser need to use Russian keywords.
      Parameters:
      isRu - true if need to use Russian keywords.
    • isOldFormat

      public boolean isOldFormat()
      Checks if string presentation must be in old format or in new format
      Returns:
      true, if true if string presentation must be in old format, false in new format
    • setOldFormat

      public void setOldFormat(boolean oldFormat)
      Sets the string presentation must be in old format or in new format.
      Parameters:
      oldFormat - true if string presentation must be in old format, false in new format
    • isAlignFields

      public boolean isAlignFields()
      Checks if need to align fields of type section to type name position.
      Returns:
      true, if need to align fields
    • setAlignFields

      public void setAlignFields(boolean alignFields)
      Sets that it need to align fieldsof type section to type name position.
      Parameters:
      alignFields - true, if need to align fields, otherwise start field from begin of line
    • getLineSeparator

      public String getLineSeparator()
      Gets the line separator.
      Returns:
      the line separator, cannot return null.
    • setLineSeparator

      public void setLineSeparator(String lineSeparator)
      Sets the line separator.
      Parameters:
      lineSeparator - the new line separator, cannot be null.
    • isLinkInBrackets

      public boolean isLinkInBrackets()
      Checks if it needs to serialize link in brackets.
      Returns:
      true, if it needs to serialize link in brackets.
    • setLinkInBrackets

      public void setLinkInBrackets(boolean linkInBrackets)
      Sets the link need to serialize in brackets.
      Parameters:
      linkInBrackets - true, if it needs to serialize link in brackets.
    • serialize

      public String serialize(BslDocumentationComment comment)
      Serializes comment to the string with default line formatter (as line separator) and default indent symbols.
      Parameters:
      comment - the documentation comment model
      Returns:
      string presentation of the documentation comment, never null, if description is empty line with IBslCommentToken.LINE_STARTER will be returned
    • serialize

      public String serialize(BslDocumentationComment comment, String lineFormatter, String indent)
      Serializes comment to the string.
      Parameters:
      comment - the documentation comment model
      lineFormatter - symbols added before IBslCommentToken.LINE_STARTER for each line, cannot be null
      indent - symbols for indent extra fields, cannot be null
      Returns:
      string presentation of the documentation comment, never null, if description is empty line with IBslCommentToken.LINE_STARTER will be returned