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 classBslDocCommentSerializer.BuilderThe 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 StringgetLineSeparator()Gets the line separator.intgetSectionSpace()Gets the line numbers of space between sections.booleanisAlignFields()Checks if need to align fields of type section to type name position.booleanisIgnoreLineNumbers()Checks if serializer ignores line numbers inmodelobjects.booleanisLinkInBrackets()Checks if it needs to serialize link in brackets.booleanisOldFormat()Checks if string presentation must be in old format or in new formatbooleanisRussian()Checks if need to use Russian keywords.static BslDocCommentSerializer.BuildernewBuilder()Creates new BslcommentBslDocCommentSerializerbuilder.Stringserialize(BslDocumentationComment comment)Serializes comment to the string with default line formatter (as line separator) and default indent symbols.Stringserialize(BslDocumentationComment comment, String lineFormatter, String indent)Serializes comment to the string.voidsetAlignFields(boolean alignFields)Sets that it need to align fieldsof type section to type name position.voidsetIgnoreLineNumbers(boolean ignoreLineNumbers)Sets serializer to ignore line numbers inmodelobjects.voidsetLineSeparator(String lineSeparator)Sets the line separator.voidsetLinkInBrackets(boolean linkInBrackets)Sets the link need to serialize in brackets.voidsetOldFormat(boolean oldFormat)Sets the string presentation must be in old format or in new format.voidsetRussian(boolean isRu)Sets serialiser need to use Russian keywords.voidsetSectionSpace(int sectionSpace)Sets the line numbers of space between sections.
-
-
-
Method Detail
-
newBuilder
public static final BslDocCommentSerializer.Builder newBuilder()
Creates new BslcommentBslDocCommentSerializerbuilder.- 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 inmodelobjects.- Returns:
- true, if serializer is ignoring line numbers
-
setIgnoreLineNumbers
public void setIgnoreLineNumbers(boolean ignoreLineNumbers)
Sets serializer to ignore line numbers inmodelobjects.- 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
trueif string presentation must be in old format,falsein new format
-
setOldFormat
public void setOldFormat(boolean oldFormat)
Sets the string presentation must be in old format or in new format.- Parameters:
oldFormat-trueif string presentation must be in old format,falsein 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_STARTERwill 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_STARTERfor each line, cannot benullindent- symbols for indent extra fields, cannot benull- Returns:
- string presentation of the documentation comment, never
null, if description is empty line withIBslCommentToken.LINE_STARTERwill be returned
-
-