Class BslDocumentationComment
- java.lang.Object
-
- com._1c.g5.v8.dt.bsl.documentation.comment.BslDocumentationComment
-
- All Implemented Interfaces:
IDescriptionPart
public class BslDocumentationComment extends Object implements 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 method
ClassBslDocumentationComment.Section
corresponding to the each part of comment. Parameters section has special sectionBslDocumentationComment.ParametersSection
. Return section has special sectionBslDocumentationComment.ReturnSection
. Text part description represents byIDescriptionPart
. Type section part represents byTypeSection
. 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 Classes Modifier and Type Class Description static class
BslDocumentationComment.Description
Class represent description of theBslDocumentationComment.Section
of the Bsl documentation comment.static class
BslDocumentationComment.ParametersSection
Class represents parameter section of the Bsl documentation comment.static class
BslDocumentationComment.ReturnSection
Class represents return section of the Bsl documentation comment.static class
BslDocumentationComment.Section
Class represents section of the Bsl documentation comment.
-
Constructor Summary
Constructors Constructor Description BslDocumentationComment()
Empty constructorBslDocumentationComment(BslContextDefMethod method)
Constructor byBslContextDefMethod
BslDocumentationComment(Module module, Method method, int[] lineLocalOffsets)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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, boolean oldFormat, org.eclipse.emf.ecore.EObject context)
Computes real types for parameter fromParameterSection
Collection<TypeItem>
computeReturnTypes(org.eclipse.xtext.scoping.IScope typeScope, org.eclipse.xtext.scoping.IScopeProvider scopeProvider, org.eclipse.xtext.naming.IQualifiedNameConverter qualifiedNameConverter, BslMultiLineCommentDocumentationProvider commentProvider, boolean oldFormat, org.eclipse.emf.ecore.EObject context)
Computes real types forBslDocumentationComment.ReturnSection
BslDocumentationComment.Section
getCallOptionsSection()
Gets the actual description of the call optionsBslDocumentationComment.Section
BslDocumentationComment.Section
getCommentSection(int lineNumber)
Gets actual documentation commentBslDocumentationComment.Section
by line numberBslDocumentationComment.Description
getDescription()
Gets the main commentBslDocumentationComment.Description
IDescriptionPart
getDescriptionPart(int lineNumber, int offset)
Gets actual documentation commentIDescriptionPart
by line number and local line offsetBslDocumentationComment.Section
getExampleSection()
Gets the actual description of the exampleBslDocumentationComment.Section
int[]
getLineGlobalOffsets()
Gets the offsets of the each line in comment relatively to the total method text, cannot benull
int
getLineNumber()
Gets the line nubmer corresponding to part.Method
getMethod()
Gets the methodMethod
of the documentation commentModule
getModule()
Gets the moduleModule
of the documentation commentint
getOffset()
Gets offset of the begining part.BslDocumentationComment.ParametersSection
getParametersSection()
Gets the actual description of theBslDocumentationComment.ParametersSection
IDescriptionPart
getParent()
Gets the parent object.BslDocumentationComment.ReturnSection
getReturnSection()
Gets the actual description of theBslDocumentationComment.ReturnSection
boolean
isDeprecated()
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
parse(List<String> templateLines, List<String> paramNames)
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 Detail
-
BslDocumentationComment
public BslDocumentationComment()
Empty constructor
-
BslDocumentationComment
public BslDocumentationComment(Module module, Method method, int[] lineLocalOffsets)
Constructor
-
BslDocumentationComment
public BslDocumentationComment(BslContextDefMethod method)
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 Detail
-
getModule
public Module 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
public Method 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
public IDescriptionPart 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
public BslDocumentationComment.Description getDescription()
Gets the main commentBslDocumentationComment.Description
- Returns:
- the main comment
BslDocumentationComment.Description
, nevernull
-
setDescription
public void setDescription(BslDocumentationComment.Description description)
Sets the main commentBslDocumentationComment.Description
- Parameters:
description
- new commentBslDocumentationComment.Description
, cannot benull
-
setParametersSection
public void setParametersSection(BslDocumentationComment.ParametersSection parametersSection)
- Parameters:
parametersSection
- newBslDocumentationComment.ParametersSection
, can benull
if there is no this section
-
getParametersSection
public BslDocumentationComment.ParametersSection getParametersSection()
Gets the actual description of theBslDocumentationComment.ParametersSection
- Returns:
- actual description of the
BslDocumentationComment.ParametersSection
, can benull
if there is no it
-
setReturnSection
public void setReturnSection(BslDocumentationComment.ReturnSection returnSection)
- Parameters:
returnSection
-BslDocumentationComment.ReturnSection
, can benull
of there is no this section
-
getReturnSection
public BslDocumentationComment.ReturnSection getReturnSection()
Gets the actual description of theBslDocumentationComment.ReturnSection
- Returns:
- actual description of the
BslDocumentationComment.ReturnSection
, can benull
if there is no it
-
getExampleSection
public BslDocumentationComment.Section 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
public void setExampleSection(BslDocumentationComment.Section exampleSection)
Sets new exampleBslDocumentationComment.Section
- Parameters:
exampleSection
- exampleBslDocumentationComment.Section
, can benull
of there is no this section
-
getCallOptionsSection
public BslDocumentationComment.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
public void setCallOptionsSection(BslDocumentationComment.Section callOptionsSection)
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
public void parse(List<String> templateLines, List<String> paramNames)
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
public void parseOldFormat(List<String> templateLines, List<String> paramNames)
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, boolean oldFormat, org.eclipse.emf.ecore.EObject context)
Computes real types forBslDocumentationComment.ReturnSection
- Parameters:
typeScope
- actual typesIScope
, cannot benull
scopeProvider
- actualIScopeProvider
, cannot benull
qualifiedNameConverter
- actualIQualifiedNameConverter
, cannot benull
commentProvider
- actualBslMultiLineCommentDocumentationProvider
, cannot benull
oldFormat
-true
if comment in old format,false
in new formatcontext
-EObject
for resolving elements, cannot 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, boolean oldFormat, org.eclipse.emf.ecore.EObject context)
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
oldFormat
-true
if comment in old format,false
in new formatcontext
-EObject
for resolving elements, cannot benull
- Returns:
- collection of
TypeItem
s described inParameterSection
for parameter with concrete name, nevernull
-
getCommentSection
public BslDocumentationComment.Section getCommentSection(int lineNumber)
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
public IDescriptionPart getDescriptionPart(int lineNumber, int offset)
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
-
-