## com.google.javascript.rhino
Class JSDocInfoBuilder

    java.lang.Object
      com.google.javascript.rhino.JSDocInfoBuilder

    public final class JSDocInfoBuilder

extends Object

A builder for `JSDocInfo` objects. This builder abstracts the construction process of `JSDocInfo` objects whilst minimizing the number of instances of `JSDocInfo` objects. It provides early incompatibility detection among properties stored on the `JSDocInfo` object being created.

Constructor Summary
`JSDocInfoBuilder(boolean parseDocumentation)`

Method Summary
`boolean` | `addAuthor(String author)` Adds an author to the current information.
`boolean` | `addReference(String reference)` Adds a reference ("@see") to the current information.
`JSDocInfo` | `build(Node associatedNode)` Builds a `JSDocInfo` object based on the populated information and returns it.
`boolean` | `hasParameter(String name)`
`boolean` | `isConstructorRecorded()` Whether the `JSDocInfo` being built will have its `JSDocInfo.isConstructor()` flag set to `true`.
`boolean` | `isDescriptionRecorded()` Returns whether this builder recorded a description.
`boolean` | `isInterfaceRecorded()` Whether the `JSDocInfo` being built will have its `JSDocInfo.isInterface()` flag set to `true`.
`boolean` | `isJavaDispatch()` Whether the `JSDocInfo` being built will have its `JSDocInfo.isJavaDispatch()` flag set to `true`.
`boolean` | `isPopulated()` Returns whether this builder is populated with information that can be used to `build(com.google.javascript.rhino.Node)` a `JSDocInfo` object.
`boolean` | `isPopulatedWithFileOverview()` Returns whether this builder is populated with information that can be used to `build(com.google.javascript.rhino.Node)` a `JSDocInfo` object that has a fileoverview tag.
`void` | `markAnnotation(String annotation, int lineno, int charno)` Adds a marker to the current JSDocInfo and populates the marker with the annotation information.
`void` | `markName(String name, int lineno, int charno)` Deprecated. Use #markName(String, StaticSourceFile, int, int)
`void` | `markName(String name, StaticSourceFile file, int lineno, int charno)` Adds a name declaration to the current marker.
`void` | `markText(String text, int startLineno, int startCharno, int endLineno, int endCharno)` Adds a textual block to the current marker.
`void` | `markTypeNode(Node typeNode, int lineno, int startCharno, int endLineno, int endCharno, boolean hasLC)` Adds a type declaration to the current marker.
`boolean` | `recordBaseType(JSTypeExpression jsType)` Records a base type.
`boolean` | `recordBlockDescription(String description)` Records a block-level description.
`boolean` | `recordConsistentIdGenerator()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isConsistentIdGenerator()` flag set to `true`.
`boolean` | `recordConstancy()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isConstant()` flag set to `true`.
`boolean` | `recordConstructor()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isConstructor()` flag set to `true`.
`boolean` | `recordDefineType(JSTypeExpression type)` Records the type of a define.
`boolean` | `recordDeprecated()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isDeprecated()` flag set to `true`.
`boolean` | `recordDeprecationReason(String reason)` Records the deprecation reason.
`boolean` | `recordDescription(String description)` Records a description giving context for translation (i18n).
`boolean` | `recordEnumParameterType(JSTypeExpression type)` Records a parameter type to an enum.
`boolean` | `recordExport()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isExport()` flag set to `true`.
`boolean` | `recordExpose()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isExpose()` flag set to `true`.
`boolean` | `recordExtendedInterface(JSTypeExpression interfaceType)` Records an extended interface type.
`boolean` | `recordExterns()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isExterns()` flag set to `true`.
`boolean` | `recordFileOverview(String description)` Records a fileoverview description.
`boolean` | `recordHiddenness()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isHidden()` flag set to `true`.
`boolean` | `recordIdGenerator()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isIdGenerator()` flag set to `true`.
`boolean` | `recordImplementedInterface(JSTypeExpression interfaceName)` Records an implemented interface.
`boolean` | `recordImplicitCast()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isImplicitCast()` flag set to `true`.
`boolean` | `recordInterface()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isInterface()` flag set to `true`.
`boolean` | `recordJavaDispatch()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isJavaDispatch()` flag set to `true`.
`boolean` | `recordLends(String name)` Records that we're lending to another name.
`boolean` | `recordMeaning(String meaning)` Records a meaning giving context for translation (i18n).
`boolean` | `recordModifies(Set<String> modifies)` Records the list of modifies warnings.
`boolean` | `recordNoAlias()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isNoAlias()` flag set to `true`.
`boolean` | `recordNoCompile()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isNoCompile()` flag set to `true`.
`boolean` | `recordNoShadow()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isNoShadow()` flag set to `true`.
`boolean` | `recordNoSideEffects()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isNoSideEffects()` flag set to `true`.
`boolean` | `recordNoTypeCheck()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isNoTypeCheck()` flag set to `true`.
`void` | `recordOriginalCommentString(String sourceComment)` Sets the original JSDoc comment string.
`boolean` | `recordOverride()` Records that the `JSDocInfo` being built should have its `JSDocInfo.isOverride()` flag set to `true`.
`boolean` | `recordParameter(String parameterName, JSTypeExpression type)` Records a typed parameter.
`boolean` | `recordParameterDescription(String parameterName, String description)` Records a parameter's description.
`boolean` | `recordPreserveTry()` Records that the `JSDocInfo` being built should have its `JSDocInfo.shouldPreserveTry()` flag set to `true`.
`boolean` | `recordReturnDescription(String description)` Records a return description
`boolean` | `recordReturnType(JSTypeExpression jsType)` Records a return type.
`boolean` | `recordSuppressions(Set<String> suppressions)` Records the list of suppressed warnings.
`boolean` | `recordTemplateTypeName(String name)` Records a template type name.
`boolean` | `recordThisType(JSTypeExpression type)` Records a type for `@this` annotation.
`boolean` | `recordThrowDescription(JSTypeExpression type, String description)` Records a throw type's description.
`boolean` | `recordThrowType(JSTypeExpression type)` Records a thrown type.
`boolean` | `recordType(JSTypeExpression type)` Records a type.
`boolean` | `recordTypedef(JSTypeExpression type)` Records that the `JSDocInfo` being built should be populated with a `typedef`'d type.
`boolean` | `recordVersion(String version)` Records the version.
`boolean` | `recordVisibility(JSDocInfo.Visibility visibility)` Records a visibility.
`boolean` | `shouldParseDocumentation()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JSDocInfoBuilder

    public JSDocInfoBuilder(boolean parseDocumentation)

Method Detail

### recordOriginalCommentString

    public void recordOriginalCommentString(String sourceComment)

  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 to `build(com.google.javascript.rhino.Node)` a `JSDocInfo` object.

### isPopulatedWithFileOverview

    public boolean isPopulatedWithFileOverview()

  Returns whether this builder is populated with information that can be used to `build(com.google.javascript.rhino.Node)` a `JSDocInfo` object that has a fileoverview tag.

### isDescriptionRecorded

    public boolean isDescriptionRecorded()

  Returns whether this builder recorded a description.

### build

    public JSDocInfo build(Node associatedNode)

  Builds a `JSDocInfo` object based on the populated information and returns it. Once this method is called, the builder can be reused to build another `JSDocInfo` object.

  Parameters:
    `associatedNode` - The source node containing the JSDoc.
  Returns:
    a `JSDocInfo` object populated with the values given to this builder. If no value was populated, this method simply returns `null`

### markAnnotation

    public void markAnnotation(String annotation,
                               int lineno,
                               int charno)

  Adds a marker to the current JSDocInfo and populates the marker with the annotation information.

### markText

    public void markText(String text,
                         int startLineno,
                         int startCharno,
                         int endLineno,
                         int endCharno)

  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
    public void markName(String name,
                                    int lineno,
                                    int charno)

  Deprecated. Use #markName(String, StaticSourceFile, int, int)

  Adds a name declaration to the current marker.

### markName

    public void markName(String name,
                         StaticSourceFile file,
                         int lineno,
                         int charno)

  Adds a name declaration to the current marker.

### recordBlockDescription

    public boolean recordBlockDescription(String description)

  Records a block-level description.

  Returns:
    `true` if the description was recorded.

### recordVisibility

    public boolean recordVisibility(JSDocInfo.Visibility visibility)

  Records a visibility.

  Returns:
    `true` if the visibility was recorded and `false` if it was already defined

### recordParameter

    public boolean recordParameter(String parameterName,
                                   JSTypeExpression type)

  Records a typed parameter.

  Returns:
    `true` if the typed parameter was recorded and `false` if a parameter with the same name was already defined

### recordParameterDescription

    public boolean recordParameterDescription(String parameterName,
                                              String description)

  Records a parameter's description.

  Returns:
    `true` if the parameter's description was recorded and `false` if a parameter with the same name was already defined

### recordTemplateTypeName

    public boolean recordTemplateTypeName(String name)

  Records a template type name.

  Returns:
    `true` if the template type name was recorded and `false` if a template type name was already defined.

### recordThrowType

    public boolean recordThrowType(JSTypeExpression type)

  Records a thrown type.

### recordThrowDescription

    public boolean recordThrowDescription(JSTypeExpression type,
                                          String description)

  Records a throw type's description.

  Returns:
    `true` if the type's description was recorded and `false` if a description with the same type was already defined

### addAuthor

    public boolean addAuthor(String author)

  Adds an author to the current information.

### addReference

    public boolean addReference(String reference)

  Adds a reference ("@see") to the current information.

### recordConsistentIdGenerator

    public boolean recordConsistentIdGenerator()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isConsistentIdGenerator()` flag set to `true`.

  Returns:
    `true` if the consistentIdGenerator flag was recorded and `false` if it was already recorded

### recordVersion

    public boolean recordVersion(String version)

  Records the version.

### recordDeprecationReason

    public boolean recordDeprecationReason(String reason)

  Records the deprecation reason.

### recordSuppressions

    public boolean recordSuppressions(Set<String> suppressions)

  Records the list of suppressed warnings.

### recordModifies

    public boolean recordModifies(Set<String> modifies)

  Records the list of modifies warnings.

### recordType

    public boolean recordType(JSTypeExpression type)

  Records a type.

  Returns:
    `true` if the type was recorded and `false` if it is invalid or was already defined

### recordTypedef

    public boolean recordTypedef(JSTypeExpression type)

  Records that the `JSDocInfo` being built should be populated with a `typedef`'d type.

### recordIdGenerator

    public boolean recordIdGenerator()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isIdGenerator()` flag set to `true`.

  Returns:
    `true` if the idGenerator flag was recorded and `false` if it was already recorded

### recordReturnType

    public boolean recordReturnType(JSTypeExpression jsType)

  Records a return type.

  Returns:
    `true` if the return type was recorded and `false` if it is invalid or was already defined

### recordReturnDescription

    public boolean recordReturnDescription(String description)

  Records a return description

  Returns:
    `true` if the return description was recorded and `false` if it is invalid or was already defined

### recordDefineType

    public boolean recordDefineType(JSTypeExpression type)

  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

    public boolean recordEnumParameterType(JSTypeExpression type)

  Records a parameter type to an enum.

  Returns:
    `true` if the enum's parameter type was recorded and `false` if it was invalid or already defined

### recordThisType

    public boolean recordThisType(JSTypeExpression type)

  Records a type for `@this` annotation.

  Returns:
    `true` if the type was recorded and `false` if it is invalid or if it collided with `@enum` or `@type` annotations

### recordBaseType

    public boolean recordBaseType(JSTypeExpression jsType)

  Records a base type.

  Returns:
    `true` if the base type was recorded and `false` if it was already defined

### recordConstancy

    public boolean recordConstancy()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isConstant()` flag set to `true`.

  Returns:
    `true` if the constancy was recorded and `false` if it was already defined

### recordDescription

    public boolean recordDescription(String description)

  Records a description giving context for translation (i18n).

  Returns:
    `true` if the description was recorded and `false` if the description was invalid or was already defined

### recordMeaning

    public boolean recordMeaning(String meaning)

  Records a meaning giving context for translation (i18n). Different meanings will result in different translations.

  Returns:
    `true` If the meaning was successfully updated.

### recordFileOverview

    public boolean recordFileOverview(String description)

  Records a fileoverview description.

  Returns:
    `true` if the description was recorded and `false` if the description was invalid or was already defined.

### recordHiddenness

    public boolean recordHiddenness()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isHidden()` flag set to `true`.

  Returns:
    `true` if the hiddenness was recorded and `false` if it was already defined

### recordNoCompile

    public boolean recordNoCompile()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isNoCompile()` flag set to `true`.

  Returns:
    `true` if the no compile flag was recorded and `false` if it was already recorded

### recordNoTypeCheck

    public boolean recordNoTypeCheck()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isNoTypeCheck()` flag set to `true`.

  Returns:
    `true` if the no check flag was recorded and `false` if it was already recorded

### recordConstructor

    public boolean recordConstructor()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isConstructor()` flag set to `true`.

  Returns:
    `true` if the constructor was recorded and `false` if it was already defined or it was incompatible with the existing flags

### isConstructorRecorded

    public boolean isConstructorRecorded()

  Whether the `JSDocInfo` being built will have its `JSDocInfo.isConstructor()` flag set to `true`.

### recordJavaDispatch

    public boolean recordJavaDispatch()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isJavaDispatch()` flag set to `true`.

  Returns:
    `true` if the javadispatch was recorded and `false` if it was already defined or it was incompatible with the existing flags

### isJavaDispatch

    public boolean isJavaDispatch()

  Whether the `JSDocInfo` being built will have its `JSDocInfo.isJavaDispatch()` flag set to `true`.

### recordPreserveTry

    public boolean recordPreserveTry()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.shouldPreserveTry()` flag set to `true`.

### recordOverride

    public boolean recordOverride()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isOverride()` flag set to `true`.

### recordNoAlias

    public boolean recordNoAlias()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isNoAlias()` flag set to `true`.

### recordDeprecated

    public boolean recordDeprecated()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isDeprecated()` flag set to `true`.

### recordInterface

    public boolean recordInterface()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isInterface()` flag set to `true`.

  Returns:
    `true` if the flag was recorded and `false` if it was already defined or it was incompatible with the existing flags

### recordExport

    public boolean recordExport()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isExport()` flag set to `true`.

### recordExpose

    public boolean recordExpose()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isExpose()` flag set to `true`.

### recordNoShadow

    public boolean recordNoShadow()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isNoShadow()` flag set to `true`.

### recordImplicitCast

    public boolean recordImplicitCast()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isImplicitCast()` flag set to `true`.

### recordNoSideEffects

    public boolean recordNoSideEffects()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isNoSideEffects()` flag set to `true`.

### recordExterns

    public boolean recordExterns()

  Records that the `JSDocInfo` being built should have its `JSDocInfo.isExterns()` flag set to `true`.

### isInterfaceRecorded

    public boolean isInterfaceRecorded()

  Whether the `JSDocInfo` being built will have its `JSDocInfo.isInterface()` flag set to `true`.

### hasParameter

    public boolean hasParameter(String name)

  Returns:
    Whether a parameter of the given name has already been recorded.

### recordImplementedInterface

    public boolean recordImplementedInterface(JSTypeExpression interfaceName)

  Records an implemented interface.

### recordExtendedInterface

    public boolean recordExtendedInterface(JSTypeExpression interfaceType)

  Records an extended interface type.

### recordLends

    public boolean recordLends(String name)

  Records that we're lending to another name.