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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BslDocCommentSerializer.Builder
The configuration builder ofserializer
-
Constructor Summary
Constructors Constructor Description BslDocCommentSerializer()
Instantiates a new bsl doc comment serializer with defaul section space = 2 and ignoring line numbers in the model.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getLineSeparator()
Gets the line separator.int
getSectionSpace()
Gets the line numbers of space between sections.boolean
isAlignFields()
Checks if need to align fields of type section to type name position.boolean
isIgnoreLineNumbers()
Checks if serializer ignores line numbers inmodel
objects.boolean
isLinkInBrackets()
Checks if it needs to serialize link in brackets.boolean
isOldFormat()
Checks if string presentation must be in old format or in new formatboolean
isRussian()
Checks if need to use Russian keywords.static BslDocCommentSerializer.Builder
newBuilder()
Creates new Bslcomment
BslDocCommentSerializer
builder.String
serialize(BslDocumentationComment comment)
Serializes comment to the string with default line formatter (as line separator) and default indent symbols.String
serialize(BslDocumentationComment comment, String lineFormatter, String indent)
Serializes comment to the string.void
setAlignFields(boolean alignFields)
Sets that it need to align fieldsof type section to type name position.void
setIgnoreLineNumbers(boolean ignoreLineNumbers)
Sets serializer to ignore line numbers inmodel
objects.void
setLineSeparator(String lineSeparator)
Sets the line separator.void
setLinkInBrackets(boolean linkInBrackets)
Sets the link need to serialize in brackets.void
setOldFormat(boolean oldFormat)
Sets the string presentation must be in old format or in new format.void
setRussian(boolean isRu)
Sets serialiser need to use Russian keywords.void
setSectionSpace(int sectionSpace)
Sets the line numbers of space between sections.
-
-
-
Method Detail
-
newBuilder
public static final BslDocCommentSerializer.Builder newBuilder()
Creates new Bslcomment
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 inmodel
objects.- Returns:
- true, if serializer is ignoring line numbers
-
setIgnoreLineNumbers
public void setIgnoreLineNumbers(boolean ignoreLineNumbers)
Sets serializer to ignore line numbers inmodel
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 benull
.
-
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 withIBslCommentToken.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 modellineFormatter
- symbols added beforeIBslCommentToken.LINE_STARTER
for each line, cannot benull
indent
- symbols for indent extra fields, cannot benull
- Returns:
- string presentation of the documentation comment, never
null
, if description is empty line withIBslCommentToken.LINE_STARTER
will be returned
-
-