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 class
Class represent description of theBslDocumentationComment.Section
of the Bsl documentation comment.static class
Class represents parameter section of the Bsl documentation comment.static class
Class represents return section of the Bsl documentation comment.static class
Class represents section of the Bsl documentation comment. -
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructorConstructor byBslContextDefMethod
BslDocumentationComment
(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 fromParameterSection
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
Gets the actual description of the call optionsBslDocumentationComment.Section
getCommentSection
(int lineNumber) Gets actual documentation commentBslDocumentationComment.Section
by line numberGets the main commentBslDocumentationComment.Description
getDescriptionPart
(int lineNumber, int offset) Gets actual documentation commentIDescriptionPart
by line number and local line offsetGets the actual description of the exampleBslDocumentationComment.Section
int[]
Gets the offsets of the each line in comment relatively to the total method text, cannot benull
int
Gets the line nubmer corresponding to part.Gets the methodMethod
of the documentation commentGets the moduleModule
of the documentation commentint
Gets offset of the begining part.Gets the actual description of theBslDocumentationComment.ParametersSection
Gets the parent object.Gets the actual description of theBslDocumentationComment.ReturnSection
boolean
Checks that special keyword for marking method as deprecated foundboolean
match
(int lineNumber, int offset) Checks that this description part corresponding to the concrete line number and offsetvoid
Parses comment lines corresponding to the new documentation formatvoid
parseOldFormat
(List<String> templateLines, List<String> paramNames) Parses comment lines corresponding to the old documentation formatvoid
setCallOptionsSection
(BslDocumentationComment.Section callOptionsSection) Sets new call optionsBslDocumentationComment.Section
void
setDeprecated
(boolean deprecated) Sets that documentation comment corresponding to the deprecated methodvoid
setDescription
(BslDocumentationComment.Description description) Sets the main commentBslDocumentationComment.Description
void
setExampleSection
(BslDocumentationComment.Section exampleSection) Sets new exampleBslDocumentationComment.Section
void
setParametersSection
(BslDocumentationComment.ParametersSection parametersSection) void
setReturnSection
(BslDocumentationComment.ReturnSection returnSection)
-
Constructor Details
-
BslDocumentationComment
public BslDocumentationComment()Empty constructor -
BslDocumentationComment
Constructor -
BslDocumentationComment
Constructor byBslContextDefMethod
- Parameters:
method
-BslContextDefMethod
contains 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 moduleModule
of the documentation comment- Returns:
- the module
Module
of the documentation comment, can benull
if model created not from method documentation comment nodes.
-
getMethod
Gets the methodMethod
of the documentation comment- Returns:
- the method
Method
can benull
if 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:IDescriptionPart
Gets the parent object.- Specified by:
getParent
in interfaceIDescriptionPart
- Returns:
- the parent object, can return
null
if it is root objectBslDocumentationComment
or object created separetly form parsing source code.
-
getOffset
public int getOffset()Description copied from interface:IDescriptionPart
Gets offset of the begining part. Offset - local inline offset- Specified by:
getOffset
in interfaceIDescriptionPart
- Returns:
- offset of the begining part.
-
getLineNumber
public int getLineNumber()Description copied from interface:IDescriptionPart
Gets 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:
getLineNumber
in interfaceIDescriptionPart
- Returns:
- the line nubmer corresponding to part
-
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 interfaceIDescriptionPart
- Parameters:
lineNumber
- number of the documentation comment lineoffset
- local offset on the comment line- Returns:
true
if this description part corresponding to the send line number and offset,false
otherwise
-
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 benull
if there is no this section
-
getParametersSection
Gets the actual description of theBslDocumentationComment.ParametersSection
- Returns:
- actual description of the
BslDocumentationComment.ParametersSection
, can benull
if there is no it
-
setReturnSection
- Parameters:
returnSection
-BslDocumentationComment.ReturnSection
, can benull
of there is no this section
-
getReturnSection
Gets the actual description of theBslDocumentationComment.ReturnSection
- Returns:
- actual description of the
BslDocumentationComment.ReturnSection
, can benull
if there is no it
-
getExampleSection
Gets the actual description of the exampleBslDocumentationComment.Section
- Returns:
- actual description of the example
BslDocumentationComment.Section
, can benull
if there is no it
-
setExampleSection
Sets new exampleBslDocumentationComment.Section
- Parameters:
exampleSection
- exampleBslDocumentationComment.Section
, can benull
of 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 benull
if there is no it
-
setCallOptionsSection
Sets new call optionsBslDocumentationComment.Section
- Parameters:
exampleSection
- call optionsBslDocumentationComment.Section
, can benull
of there is no this section
-
isDeprecated
public boolean isDeprecated()Checks that special keyword for marking method as deprecated found- Returns:
true
if the main description part start with keywordsIBslCommentToken.DEPRECATED
orIBslCommentToken.DEPRECATED_RU
,false
otherwise
-
setDeprecated
public void setDeprecated(boolean deprecated) Sets that documentation comment corresponding to the deprecated method- Parameters:
deprecated
-true
if documentation comment corresponding to the deprecated method,false
otherwise
-
parse
Parses comment lines corresponding to the new documentation format- Parameters:
templateLines
- initial string line of the comment content, cannot benull
paramNames
- 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 benull
paramNames
- 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 benull
scopeProvider
- actualIScopeProvider
, cannot benull
qualifiedNameConverter
- actualIQualifiedNameConverter
, cannot benull
commentProvider
- actualBslMultiLineCommentDocumentationProvider
, cannot benull
v8ProjectManager
-IV8ProjectManager
for gettingIV8Project
byEObject
, cannot benull
oldFormat
-true
if comment in old format,false
in new formatcontext
-EObject
for resolving elements, cannot benull
typeComputationContext
- Type system computation context. May not benull
- Returns:
- collection of
TypeItem
s 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 benull
typeScope
- actual typesIScope
, cannot benull
scopeProvider
- actualIScopeProvider
, cannot benull
qualifiedNameConverter
- actualIQualifiedNameConverter
, cannot benull
commentProvider
- actualBslMultiLineCommentDocumentationProvider
, cannot benull
v8ProjectManager
-IV8ProjectManager
for gettingIV8Project
byEObject
, cannot benull
oldFormat
-true
if comment in old format,false
in new formatcontext
-EObject
for resolving elements, cannot benull
typeComputationContext
- Type system computation context. May not benull
- Returns:
- collection of
TypeItem
s described inParameterSection
for parameter with concrete name, nevernull
-
getCommentSection
Gets actual documentation commentBslDocumentationComment.Section
by line number- Parameters:
lineNumber
- number of the comment line for gettingBslDocumentationComment.Section
- Returns:
BslDocumentationComment.Section
corresponding to the line number, can benull
if there is no section on this line
-
getDescriptionPart
Gets actual documentation commentIDescriptionPart
by line number and local line offset- Parameters:
lineNumber
- number of the comment line for gettingIDescriptionPart
offset
- local line offset for gettingIDescriptionPart
- Returns:
IDescriptionPart
corresponding to the line number and local line offset, can benull
if there is no description part on this line number and offset
-