Class BslDocumentationComment
java.lang.Object
com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment
- All Implemented Interfaces:
IDescriptionPart
Class represents the Bsl documentation comment as in new format and in old format.
Common description of the documentation comment is:
//(Deprecated. | Устарела)? Description //(Parameters: | Параметры:) //* parameterName1 ((type section description) | (text description)) //... //* parameterNameN ((type section description) | (text description)) //(Call options: | Варианты вызова:) //text description of the method call options //(Returns: | Возвращаемое значение:) //((type section description) | (text description)) //(Example: | Пример:) //text description of the example of using methodClass
BslDocumentationComment.Section corresponding to the each part of comment. Parameters section has special section BslDocumentationComment.ParametersSection.
Return section has special section BslDocumentationComment.ReturnSection.
Text part description represents by IDescriptionPart.
Type section part represents by TypeSection.
Differences between old and new format is little:
- keywords "Returns:" replaced to "Return value" in old format
- there is no "*" before parameterName in oldFormat
- differences in type section description - see
TypeSection
IBslCommentToken-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classClass represent description of theBslDocumentationComment.Sectionof the Bsl documentation comment.static classClass represents parameter section of the Bsl documentation comment.static classClass represents return section of the Bsl documentation comment.static classClass represents section of the Bsl documentation comment. -
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructorConstructor byBslContextDefMethodBslDocumentationComment(Module module, Method method, int[] lineLocalOffsets) Constructor -
Method Summary
Modifier and TypeMethodDescriptioncomputeParameterTypes(String name, org.eclipse.xtext.scoping.IScope typeScope, org.eclipse.xtext.scoping.IScopeProvider scopeProvider, org.eclipse.xtext.naming.IQualifiedNameConverter qualifiedNameConverter, BslMultiLineCommentDocumentationProvider commentProvider, IV8ProjectManager v8ProjectManager, boolean oldFormat, org.eclipse.emf.ecore.EObject context, BmOperationContext typeComputationContext) Computes real types for parameter fromParameterSectioncomputeReturnTypes(org.eclipse.xtext.scoping.IScope typeScope, org.eclipse.xtext.scoping.IScopeProvider scopeProvider, org.eclipse.xtext.naming.IQualifiedNameConverter qualifiedNameConverter, BslMultiLineCommentDocumentationProvider commentProvider, IV8ProjectManager v8ProjectManager, boolean oldFormat, org.eclipse.emf.ecore.EObject context, BmOperationContext typeComputationContext) Computes real types forBslDocumentationComment.ReturnSectionGets the actual description of the call optionsBslDocumentationComment.SectiongetCommentSection(int lineNumber) Gets actual documentation commentBslDocumentationComment.Sectionby line numberGets the main commentBslDocumentationComment.DescriptiongetDescriptionPart(int lineNumber, int offset) Gets actual documentation commentIDescriptionPartby line number and local line offsetGets the actual description of the exampleBslDocumentationComment.Sectionint[]Gets the offsets of the each line in comment relatively to the total method text, cannot benullintGets the line nubmer corresponding to part.Gets the methodMethodof the documentation commentGets the moduleModuleof the documentation commentintGets offset of the begining part.Gets the actual description of theBslDocumentationComment.ParametersSectionGets the parent object.Gets the actual description of theBslDocumentationComment.ReturnSectionbooleanChecks that special keyword for marking method as deprecated foundbooleanmatch(int lineNumber, int offset) Checks that this description part corresponding to the concrete line number and offsetvoidParses comment lines corresponding to the new documentation formatvoidparseOldFormat(List<String> templateLines, List<String> paramNames) Parses comment lines corresponding to the old documentation formatvoidsetCallOptionsSection(BslDocumentationComment.Section callOptionsSection) Sets new call optionsBslDocumentationComment.SectionvoidsetDeprecated(boolean deprecated) Sets that documentation comment corresponding to the deprecated methodvoidsetDescription(BslDocumentationComment.Description description) Sets the main commentBslDocumentationComment.DescriptionvoidsetExampleSection(BslDocumentationComment.Section exampleSection) Sets new exampleBslDocumentationComment.SectionvoidsetParametersSection(BslDocumentationComment.ParametersSection parametersSection) voidsetReturnSection(BslDocumentationComment.ReturnSection returnSection)
-
Constructor Details
-
BslDocumentationComment
public BslDocumentationComment()Empty constructor -
BslDocumentationComment
Constructor -
BslDocumentationComment
Constructor byBslContextDefMethod- Parameters:
method-BslContextDefMethodcontains content of the documentation comment adn offsets of the each line in comment relatively to the total method text, cannot benull
-
-
Method Details
-
getModule
Gets the moduleModuleof the documentation comment- Returns:
- the module
Moduleof the documentation comment, can benullif model created not from method documentation comment nodes.
-
getMethod
Gets the methodMethodof the documentation comment- Returns:
- the method
Methodcan benullif model created not from method documentation comment nodes.
-
getLineGlobalOffsets
public int[] getLineGlobalOffsets()Gets the offsets of the each line in comment relatively to the total method text, cannot benull- Returns:
- the offsets of the each line in comment, cannot return
null.
-
getParent
Description copied from interface:IDescriptionPartGets the parent object.- Specified by:
getParentin interfaceIDescriptionPart- Returns:
- the parent object, can return
nullif it is root objectBslDocumentationCommentor object created separetly form parsing source code.
-
getOffset
public int getOffset()Description copied from interface:IDescriptionPartGets offset of the begining part. Offset - local inline offset- Specified by:
getOffsetin interfaceIDescriptionPart- Returns:
- offset of the begining part.
-
getLineNumber
public int getLineNumber()Description copied from interface:IDescriptionPartGets the line nubmer corresponding to part. Numeration starts from 0 Line number - line number corresponding to the begining of the documentation comment. Each comment starts with line with number 0- Specified by:
getLineNumberin interfaceIDescriptionPart- Returns:
- the line nubmer corresponding to part
-
match
public boolean match(int lineNumber, int offset) Description copied from interface:IDescriptionPartChecks that this description part corresponding to the concrete line number and offset- Specified by:
matchin interfaceIDescriptionPart- Parameters:
lineNumber- number of the documentation comment lineoffset- local offset on the comment line- Returns:
trueif this description part corresponding to the send line number and offset,falseotherwise
-
getDescription
Gets the main commentBslDocumentationComment.Description- Returns:
- the main comment
BslDocumentationComment.Description, nevernull
-
setDescription
Sets the main commentBslDocumentationComment.Description- Parameters:
description- new commentBslDocumentationComment.Description, cannot benull
-
setParametersSection
- Parameters:
parametersSection- newBslDocumentationComment.ParametersSection, can benullif there is no this section
-
getParametersSection
Gets the actual description of theBslDocumentationComment.ParametersSection- Returns:
- actual description of the
BslDocumentationComment.ParametersSection, can benullif there is no it
-
setReturnSection
- Parameters:
returnSection-BslDocumentationComment.ReturnSection, can benullof there is no this section
-
getReturnSection
Gets the actual description of theBslDocumentationComment.ReturnSection- Returns:
- actual description of the
BslDocumentationComment.ReturnSection, can benullif there is no it
-
getExampleSection
Gets the actual description of the exampleBslDocumentationComment.Section- Returns:
- actual description of the example
BslDocumentationComment.Section, can benullif there is no it
-
setExampleSection
Sets new exampleBslDocumentationComment.Section- Parameters:
exampleSection- exampleBslDocumentationComment.Section, can benullof there is no this section
-
getCallOptionsSection
Gets the actual description of the call optionsBslDocumentationComment.Section- Returns:
- actual description of the call options
BslDocumentationComment.Section, can benullif there is no it
-
setCallOptionsSection
Sets new call optionsBslDocumentationComment.Section- Parameters:
exampleSection- call optionsBslDocumentationComment.Section, can benullof there is no this section
-
isDeprecated
public boolean isDeprecated()Checks that special keyword for marking method as deprecated found- Returns:
trueif the main description part start with keywordsIBslCommentToken.DEPRECATEDorIBslCommentToken.DEPRECATED_RU,falseotherwise
-
setDeprecated
public void setDeprecated(boolean deprecated) Sets that documentation comment corresponding to the deprecated method- Parameters:
deprecated-trueif documentation comment corresponding to the deprecated method,falseotherwise
-
parse
Parses comment lines corresponding to the new documentation format- Parameters:
templateLines- initial string line of the comment content, cannot benullparamNames- names of theFormalParam, cannot benull
-
parseOldFormat
Parses comment lines corresponding to the old documentation format- Parameters:
templateLines- initial string line of the comment content, cannot benullparamNames- names of theFormalParam, cannot benull
-
computeReturnTypes
public Collection<TypeItem> computeReturnTypes(org.eclipse.xtext.scoping.IScope typeScope, org.eclipse.xtext.scoping.IScopeProvider scopeProvider, org.eclipse.xtext.naming.IQualifiedNameConverter qualifiedNameConverter, BslMultiLineCommentDocumentationProvider commentProvider, IV8ProjectManager v8ProjectManager, boolean oldFormat, org.eclipse.emf.ecore.EObject context, BmOperationContext typeComputationContext) Computes real types forBslDocumentationComment.ReturnSection- Parameters:
typeScope- actual typesIScope, cannot benullscopeProvider- actualIScopeProvider, cannot benullqualifiedNameConverter- actualIQualifiedNameConverter, cannot benullcommentProvider- actualBslMultiLineCommentDocumentationProvider, cannot benullv8ProjectManager-IV8ProjectManagerfor gettingIV8ProjectbyEObject, cannot benulloldFormat-trueif comment in old format,falsein new formatcontext-EObjectfor resolving elements, cannot benulltypeComputationContext- Type system computation context. May not benull- Returns:
- collection of
TypeItems described inBslDocumentationComment.ReturnSection, nevernull
-
computeParameterTypes
public Collection<TypeItem> computeParameterTypes(String name, org.eclipse.xtext.scoping.IScope typeScope, org.eclipse.xtext.scoping.IScopeProvider scopeProvider, org.eclipse.xtext.naming.IQualifiedNameConverter qualifiedNameConverter, BslMultiLineCommentDocumentationProvider commentProvider, IV8ProjectManager v8ProjectManager, boolean oldFormat, org.eclipse.emf.ecore.EObject context, BmOperationContext typeComputationContext) Computes real types for parameter fromParameterSection- Parameters:
name- name of the parameter fromParameterSection, cannot benulltypeScope- actual typesIScope, cannot benullscopeProvider- actualIScopeProvider, cannot benullqualifiedNameConverter- actualIQualifiedNameConverter, cannot benullcommentProvider- actualBslMultiLineCommentDocumentationProvider, cannot benullv8ProjectManager-IV8ProjectManagerfor gettingIV8ProjectbyEObject, cannot benulloldFormat-trueif comment in old format,falsein new formatcontext-EObjectfor resolving elements, cannot benulltypeComputationContext- Type system computation context. May not benull- Returns:
- collection of
TypeItems described inParameterSectionfor parameter with concrete name, nevernull
-
getCommentSection
Gets actual documentation commentBslDocumentationComment.Sectionby line number- Parameters:
lineNumber- number of the comment line for gettingBslDocumentationComment.Section- Returns:
BslDocumentationComment.Sectioncorresponding to the line number, can benullif there is no section on this line
-
getDescriptionPart
Gets actual documentation commentIDescriptionPartby line number and local line offset- Parameters:
lineNumber- number of the comment line for gettingIDescriptionPartoffset- local line offset for gettingIDescriptionPart- Returns:
IDescriptionPartcorresponding to the line number and local line offset, can benullif there is no description part on this line number and offset
-