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.Sectioncorresponding 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 classBslDocumentationComment.DescriptionClass represent description of theBslDocumentationComment.Sectionof the Bsl documentation comment.static classBslDocumentationComment.ParametersSectionClass represents parameter section of the Bsl documentation comment.static classBslDocumentationComment.ReturnSectionClass represents return section of the Bsl documentation comment.static classBslDocumentationComment.SectionClass represents section of the Bsl documentation comment.
-
Constructor Summary
Constructors Constructor Description BslDocumentationComment()Empty constructorBslDocumentationComment(BslContextDefMethod method)Constructor byBslContextDefMethodBslDocumentationComment(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, BmOperationContext typeComputationContext)Computes real types for parameter fromParameterSectionCollection<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, BmOperationContext typeComputationContext)Computes real types forBslDocumentationComment.ReturnSectionBslDocumentationComment.SectiongetCallOptionsSection()Gets the actual description of the call optionsBslDocumentationComment.SectionBslDocumentationComment.SectiongetCommentSection(int lineNumber)Gets actual documentation commentBslDocumentationComment.Sectionby line numberBslDocumentationComment.DescriptiongetDescription()Gets the main commentBslDocumentationComment.DescriptionIDescriptionPartgetDescriptionPart(int lineNumber, int offset)Gets actual documentation commentIDescriptionPartby line number and local line offsetBslDocumentationComment.SectiongetExampleSection()Gets the actual description of the exampleBslDocumentationComment.Sectionint[]getLineGlobalOffsets()Gets the offsets of the each line in comment relatively to the total method text, cannot benullintgetLineNumber()Gets the line nubmer corresponding to part.MethodgetMethod()Gets the methodMethodof the documentation commentModulegetModule()Gets the moduleModuleof the documentation commentintgetOffset()Gets offset of the begining part.BslDocumentationComment.ParametersSectiongetParametersSection()Gets the actual description of theBslDocumentationComment.ParametersSectionIDescriptionPartgetParent()Gets the parent object.BslDocumentationComment.ReturnSectiongetReturnSection()Gets the actual description of theBslDocumentationComment.ReturnSectionbooleanisDeprecated()Checks 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 offsetvoidparse(List<String> templateLines, List<String> paramNames)Parses 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 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-BslContextDefMethodcontains 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 moduleModuleof the documentation comment- Returns:
- the module
Moduleof the documentation comment, can benullif model created not from method documentation comment nodes.
-
getMethod
public Method 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
public IDescriptionPart 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
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 benullif 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 benullif there is no it
-
setReturnSection
public void setReturnSection(BslDocumentationComment.ReturnSection returnSection)
- Parameters:
returnSection-BslDocumentationComment.ReturnSection, can benullof 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 benullif 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 benullif there is no it
-
setExampleSection
public void setExampleSection(BslDocumentationComment.Section exampleSection)
Sets new exampleBslDocumentationComment.Section- Parameters:
exampleSection- exampleBslDocumentationComment.Section, can benullof 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 benullif there is no it
-
setCallOptionsSection
public void setCallOptionsSection(BslDocumentationComment.Section callOptionsSection)
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
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 benullparamNames- 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 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, 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 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, 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 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
public BslDocumentationComment.Section getCommentSection(int lineNumber)
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
public IDescriptionPart getDescriptionPart(int lineNumber, int offset)
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
-
-