Package com.google.javascript.rhino
Class JSDocInfoBuilder
java.lang.Object
com.google.javascript.rhino.JSDocInfoBuilder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds an author to the current information.booleanaddReference(String reference) Adds a reference ("@see") to the current information.Builds aJSDocInfoobject based on the populated information and returns it.booleanhasParameter(String name) booleanbooleanReturns whether this builder recorded a description.booleanbooleanbooleanReturns whether current JSDoc is annotated with@ngInject.booleanReturns whether this builder is populated with information that can be used tobuild(com.google.javascript.rhino.Node)aJSDocInfoobject.booleanReturns whether this builder is populated with information that can be used tobuild(com.google.javascript.rhino.Node)aJSDocInfoobject that has a fileoverview tag.voidmarkAnnotation(String annotation, int lineno, int charno) Adds a marker to the current JSDocInfo and populates the marker with the annotation information.voidDeprecated.Use #markName(String, StaticSourceFile, int, int)voidmarkName(String name, StaticSourceFile file, int lineno, int charno) Adds a name declaration to the current marker.voidAdds a textual block to the current marker.voidmarkTypeNode(Node typeNode, int lineno, int startCharno, int endLineno, int endCharno, boolean hasLC) Adds a type declaration to the current marker.booleanrecordBaseType(JSTypeExpression jsType) Records a base type.booleanrecordBlockDescription(String description) Records a block-level description.booleanrecordClassTemplateTypeNames(List<String> names) Records a template type name.booleanRecords that theJSDocInfobeing built should have itsJSDocInfo.isConsistentIdGenerator()flag set totrue.booleanbooleanbooleanRecords the type of a define.booleanbooleanrecordDeprecationReason(String reason) Records the deprecation reason.booleanrecordDescription(String description) Records a description giving context for translation (i18n).booleanbooleanRecords a parameter type to an enum.booleanbooleanbooleanrecordExtendedInterface(JSTypeExpression interfaceType) Records an extended interface type.booleanbooleanrecordFileOverview(String description) Records a fileoverview description.booleanbooleanbooleanrecordImplementedInterface(JSTypeExpression interfaceName) Records an implemented interface.booleanbooleanbooleanbooleanrecordLends(String name) Records that we're lending to another name.booleanrecordMeaning(String meaning) Records a meaning giving context for translation (i18n).booleanrecordModifies(Set<String> modifies) Records the list of modifies warnings.booleanrecordNgInject(boolean ngInject) Records that we'd like to add$injectproperty inferred from parameters.booleanbooleanbooleanbooleanRecords that theJSDocInfobeing built should have itsJSDocInfo.isNoSideEffects()flag set totrue.booleanvoidrecordOriginalCommentString(String sourceComment) Sets the original JSDoc comment string.booleanbooleanrecordParameter(String parameterName, JSTypeExpression type) Records a typed parameter.booleanrecordParameterDescription(String parameterName, String description) Records a parameter's description.booleanRecords that theJSDocInfobeing built should have itsJSDocInfo.shouldPreserveTry()flag set totrue.booleanrecordReturnDescription(String description) Records a return descriptionbooleanrecordReturnType(JSTypeExpression jsType) Records a return type.booleanRecords that theJSDocInfobeing built should have itsJSDocInfo.isStableIdGenerator()flag set totrue.booleanbooleanrecordSuppressions(Set<String> suppressions) Records the list of suppressed warnings.booleanrecordTemplateTypeNames(List<String> names) Records a template type name.booleanRecords a type for@thisannotation.booleanrecordThrowDescription(JSTypeExpression type, String description) Records a throw type's description.booleanRecords a thrown type.booleanrecordType(JSTypeExpression type) Records a type.booleanRecords that theJSDocInfobeing built should be populated with atypedef'd type.booleanrecordVersion(String version) Records the version.booleanrecordVisibility(JSDocInfo.Visibility visibility) Records a visibility.boolean
-
Constructor Details
-
JSDocInfoBuilder
public JSDocInfoBuilder(boolean parseDocumentation)
-
-
Method Details
-
recordOriginalCommentString
Sets the original JSDoc comment string. This is a no-op if the builder isn't configured to record documentation. -
shouldParseDocumentation
public boolean shouldParseDocumentation() -
isPopulated
public boolean isPopulated()Returns whether this builder is populated with information that can be used tobuild(com.google.javascript.rhino.Node)aJSDocInfoobject. -
isPopulatedWithFileOverview
public boolean isPopulatedWithFileOverview()Returns whether this builder is populated with information that can be used tobuild(com.google.javascript.rhino.Node)aJSDocInfoobject that has a fileoverview tag. -
isDescriptionRecorded
public boolean isDescriptionRecorded()Returns whether this builder recorded a description. -
build
Builds aJSDocInfoobject based on the populated information and returns it. Once this method is called, the builder can be reused to build anotherJSDocInfoobject.- Parameters:
associatedNode- The source node containing the JSDoc.- Returns:
- a
JSDocInfoobject populated with the values given to this builder. If no value was populated, this method simply returnsnull
-
markAnnotation
Adds a marker to the current JSDocInfo and populates the marker with the annotation information. -
markText
Adds a textual block to the current marker. -
markTypeNode
public void markTypeNode(Node typeNode, int lineno, int startCharno, int endLineno, int endCharno, boolean hasLC) Adds a type declaration to the current marker. -
markName
Deprecated.Use #markName(String, StaticSourceFile, int, int)Adds a name declaration to the current marker. -
markName
Adds a name declaration to the current marker. -
recordBlockDescription
Records a block-level description.- Returns:
trueif the description was recorded.
-
recordVisibility
Records a visibility.- Returns:
trueif the visibility was recorded andfalseif it was already defined
-
recordParameter
Records a typed parameter.- Returns:
trueif the typed parameter was recorded andfalseif a parameter with the same name was already defined
-
recordParameterDescription
Records a parameter's description.- Returns:
trueif the parameter's description was recorded andfalseif a parameter with the same name was already defined
-
recordTemplateTypeNames
Records a template type name.- Returns:
trueif the template type name was recorded andfalseif a template type name was already defined.
-
recordClassTemplateTypeNames
Records a template type name.- Returns:
trueif the template type name was recorded andfalseif a template type name was already defined.
-
recordThrowType
Records a thrown type. -
recordThrowDescription
Records a throw type's description.- Returns:
trueif the type's description was recorded andfalseif a description with the same type was already defined
-
addAuthor
Adds an author to the current information. -
addReference
Adds a reference ("@see") to the current information. -
recordConsistentIdGenerator
public boolean recordConsistentIdGenerator()Records that theJSDocInfobeing built should have itsJSDocInfo.isConsistentIdGenerator()flag set totrue.- Returns:
trueif the consistentIdGenerator flag was recorded andfalseif it was already recorded
-
recordStableIdGenerator
public boolean recordStableIdGenerator()Records that theJSDocInfobeing built should have itsJSDocInfo.isStableIdGenerator()flag set totrue.- Returns:
trueif the stableIdGenerator flag was recorded andfalseif it was already recorded.
-
recordVersion
Records the version. -
recordDeprecationReason
Records the deprecation reason. -
recordSuppressions
Records the list of suppressed warnings. -
recordModifies
Records the list of modifies warnings. -
recordType
Records a type.- Returns:
trueif the type was recorded andfalseif it is invalid or was already defined
-
recordTypedef
Records that theJSDocInfobeing built should be populated with atypedef'd type. -
recordIdGenerator
public boolean recordIdGenerator()- Returns:
trueif the idGenerator flag was recorded andfalseif it was already recorded
-
recordReturnType
Records a return type.- Returns:
trueif the return type was recorded andfalseif it is invalid or was already defined
-
recordReturnDescription
Records a return description- Returns:
trueif the return description was recorded andfalseif it is invalid or was already defined
-
recordDefineType
Records the type of a define. 'Define' values are special constants that may be manipulated by the compiler. They are designed to mimic the #define command in the C preprocessor. -
recordEnumParameterType
Records a parameter type to an enum.- Returns:
trueif the enum's parameter type was recorded andfalseif it was invalid or already defined
-
recordThisType
Records a type for@thisannotation.- Returns:
trueif the type was recorded andfalseif it is invalid or if it collided with@enumor@typeannotations
-
recordBaseType
Records a base type.- Returns:
trueif the base type was recorded andfalseif it was already defined
-
recordConstancy
public boolean recordConstancy()- Returns:
trueif the constancy was recorded andfalseif it was already defined
-
recordDescription
Records a description giving context for translation (i18n).- Returns:
trueif the description was recorded andfalseif the description was invalid or was already defined
-
recordMeaning
Records a meaning giving context for translation (i18n). Different meanings will result in different translations.- Returns:
trueIf the meaning was successfully updated.
-
recordFileOverview
Records a fileoverview description.- Returns:
trueif the description was recorded andfalseif the description was invalid or was already defined.
-
recordHiddenness
public boolean recordHiddenness()- Returns:
trueif the hiddenness was recorded andfalseif it was already defined
-
recordNoCompile
public boolean recordNoCompile()- Returns:
trueif the no compile flag was recorded andfalseif it was already recorded
-
recordNoTypeCheck
public boolean recordNoTypeCheck()- Returns:
trueif the no check flag was recorded andfalseif it was already recorded
-
recordConstructor
public boolean recordConstructor()- Returns:
trueif the constructor was recorded andfalseif it was already defined or it was incompatible with the existing flags
-
isConstructorRecorded
public boolean isConstructorRecorded() -
recordStruct
public boolean recordStruct()- Returns:
trueif the struct was recorded andfalseif it was already defined or it was incompatible with the existing flags
-
recordDict
public boolean recordDict()- Returns:
trueif the dict was recorded andfalseif it was already defined or it was incompatible with the existing flags
-
recordJavaDispatch
public boolean recordJavaDispatch()- Returns:
trueif the javadispatch was recorded andfalseif it was already defined or it was incompatible with the existing flags
-
isJavaDispatch
public boolean isJavaDispatch() -
recordPreserveTry
public boolean recordPreserveTry()Records that theJSDocInfobeing built should have itsJSDocInfo.shouldPreserveTry()flag set totrue. -
recordOverride
public boolean recordOverride() -
recordNoAlias
public boolean recordNoAlias() -
recordDeprecated
public boolean recordDeprecated() -
recordInterface
public boolean recordInterface()- Returns:
trueif the flag was recorded andfalseif it was already defined or it was incompatible with the existing flags
-
recordExport
public boolean recordExport() -
recordExpose
public boolean recordExpose() -
recordNoShadow
public boolean recordNoShadow() -
recordImplicitCast
public boolean recordImplicitCast() -
recordNoSideEffects
public boolean recordNoSideEffects()Records that theJSDocInfobeing built should have itsJSDocInfo.isNoSideEffects()flag set totrue. -
recordExterns
public boolean recordExterns() -
isInterfaceRecorded
public boolean isInterfaceRecorded() -
hasParameter
- Returns:
- Whether a parameter of the given name has already been recorded.
-
recordImplementedInterface
Records an implemented interface. -
recordExtendedInterface
Records an extended interface type. -
recordLends
Records that we're lending to another name. -
isNgInjectRecorded
public boolean isNgInjectRecorded()Returns whether current JSDoc is annotated with@ngInject. -
recordNgInject
public boolean recordNgInject(boolean ngInject) Records that we'd like to add$injectproperty inferred from parameters.
-