public class JSDocInfo extends Object implements Serializable
JSDoc information describing JavaScript code. JSDoc is represented as a unified object with fields for each JSDoc annotation, even though some combinations are incorrect. For instance, if a JSDoc describes an enum, it cannot have information about a return type. This implementation takes advantage of such incompatibilities to reuse fields for multiple purposes, reducing memory consumption.
Constructing JSDocInfo objects is simplified by
JSDocInfoBuilder which provides early incompatibility detection.
| Modifier and Type | Class and Description |
|---|---|
static class |
JSDocInfo.Marker
Defines a class for containing the parsing information
for this JSDocInfo.
|
static class |
JSDocInfo.NamePosition
A piece of information (found in a marker) which contains a position
with a name node.
|
static class |
JSDocInfo.StringPosition
A piece of information (found in a marker) which contains a position
with a string.
|
static class |
JSDocInfo.TypePosition
A piece of information (found in a marker) which contains a position
with a type expression syntax tree.
|
static class |
JSDocInfo.Visibility
Visibility categories.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areEquivalent(JSDocInfo jsDoc1,
JSDocInfo jsDoc2) |
JSDocInfo |
clone() |
boolean |
containsDeclaration() |
boolean |
containsFunctionDeclaration() |
boolean |
disposesOf(String parameterName)
Return whether the function disposes of specified parameter.
|
Collection<String> |
getAuthors()
Returns the list of authors or null if none.
|
JSTypeExpression |
getBaseType()
Gets the base type specified by the
@extends annotation. |
String |
getBlockDescription()
Returns the block-level description or null if none specified.
|
String |
getDeprecationReason()
Returns the deprecation reason or null if none specified.
|
String |
getDescription()
Gets the description specified by the
@desc annotation. |
String |
getDescriptionForParameter(String name)
Returns the description for the parameter with the given name, if its
exists.
|
JSTypeExpression |
getEnumParameterType()
Gets the enum parameter type specified by the
@enum annotation. |
List<JSTypeExpression> |
getExtendedInterfaces()
Returns the interfaces extended by an interface
|
int |
getExtendedInterfacesCount()
Gets the number of extended interfaces specified
|
String |
getFileOverview()
Returns the file overview or null if none specified.
|
int |
getImplementedInterfaceCount()
Gets the number of interfaces specified by the
@implements
annotation. |
List<JSTypeExpression> |
getImplementedInterfaces()
Returns the types specified by the
@implements annotation. |
String |
getLendsName()
Gets the name we're lending to in a
@lends annotation. |
String |
getLicense()
Gets the description specified by the
@license annotation. |
Collection<JSDocInfo.Marker> |
getMarkers()
Gets the list of all markers for the documentation in this JSDoc.
|
String |
getMeaning()
Gets the meaning specified by the
@meaning annotation. |
Set<String> |
getModifies()
Returns the set of sideeffect notations.
|
int |
getOriginalCommentPosition() |
String |
getOriginalCommentString()
Returns the original JSDoc comment string.
|
int |
getParameterCount()
Gets the number of parameters defined.
|
Set<String> |
getParameterNames()
Returns the set of names of the defined parameters.
|
JSTypeExpression |
getParameterType(String parameter)
Gets the parameter type.
|
Collection<String> |
getReferences()
Returns the list of references or null if none.
|
String |
getReturnDescription()
Returns the description of the returned object or null if none specified.
|
JSTypeExpression |
getReturnType()
Gets the return type specified by the
@return annotation. |
Set<String> |
getSuppressions()
Returns the set of suppressed warnings.
|
com.google.common.collect.ImmutableList<String> |
getTemplateTypeNames()
Gets the template type name.
|
JSTypeExpression |
getThisType()
Gets the type specified by the
@this annotation. |
List<JSTypeExpression> |
getThrownTypes()
Returns the list of thrown types.
|
JSTypeExpression |
getType()
Gets the type specified by the
@type annotation. |
JSTypeExpression |
getTypedefType()
Gets the typedef type specified by the
@type annotation. |
Collection<Node> |
getTypeNodes()
Returns a collection of all type nodes that are a part of this JSDocInfo.
|
com.google.common.collect.ImmutableMap<String,Node> |
getTypeTransformations()
Gets the type transformations.
|
String |
getVersion()
Returns the version or null if none.
|
JSDocInfo.Visibility |
getVisibility()
Gets the visibility specified by
@private, @protected or
@public annotation. |
boolean |
hasBaseType()
Returns whether this
JSDocInfo contains a type for @extends
annotation. |
boolean |
hasConstAnnotation() |
boolean |
hasDescriptionForParameter(String name)
Returns whether a description exists for the parameter with the specified
name.
|
boolean |
hasEnumParameterType()
Returns whether an enum parameter type, specified using the
@enum
annotation, is present on this JSDoc. |
boolean |
hasFileOverview()
Returns whether this has a fileoverview flag.
|
boolean |
hasModifies() |
boolean |
hasParameter(String parameter)
Returns whether the parameter is defined.
|
boolean |
hasParameterType(String parameter)
Returns whether the parameter has an attached type.
|
boolean |
hasReturnType()
Returns whether this
JSDocInfo contains a type for @return
annotation. |
boolean |
hasThisType()
Returns whether this
JSDocInfo contains a type for @this
annotation. |
boolean |
hasType()
Returns whether a type, specified using the
@type annotation, is
present on this JSDoc. |
boolean |
hasTypedefType()
Returns whether a typedef parameter type, specified using the
@typedef annotation, is present on this JSDoc. |
boolean |
hasTypeInformation() |
boolean |
isConsistentIdGenerator() |
boolean |
isConstant()
Returns whether the
@const annotation is present on this
JSDocInfo. |
boolean |
isConstructor()
Returns whether the
@constructor annotation is present on this
JSDocInfo. |
boolean |
isConstructorOrInterface() |
boolean |
isDefine()
Returns whether the
@define annotation is present on this
JSDocInfo. |
boolean |
isDeprecated()
Returns whether the
@deprecated annotation is present on this
JSDocInfo. |
boolean |
isDisposes()
Returns whether JSDoc is annotated with
@disposes annotation. |
boolean |
isExport()
Returns whether the
@export annotation is present on this
JSDocInfo. |
boolean |
isExpose()
Returns whether the
@expose annotation is present on this
JSDocInfo. |
boolean |
isExterns()
Returns whether the
@externs annotation is present on this
JSDocInfo. |
boolean |
isHidden()
Returns whether the
@hidden annotation is present on this
JSDocInfo. |
boolean |
isIdGenerator() |
boolean |
isImplicitCast()
Returns whether the
@implicitCast annotation is present on this
JSDocInfo. |
boolean |
isInlineType()
Returns whether the type annotation was inlined.
|
boolean |
isInterface()
Returns whether the
@interface annotation is present on this
JSDocInfo. |
boolean |
isJaggerInject()
Returns whether JSDoc is annotated with
@jaggerInject annotation. |
boolean |
isJaggerModule()
Returns whether JSDoc is annotated with
@jaggerModule annotation. |
boolean |
isJaggerProvide()
Returns whether JSDoc is annotated with
@jaggerProvidePromise annotation. |
boolean |
isJaggerProvidePromise()
Returns whether JSDoc is annotated with
@jaggerProvidePromise annotation. |
boolean |
isMappedIdGenerator() |
boolean |
isNgInject()
Returns whether JSDoc is annotated with
@ngInject annotation. |
boolean |
isNoAlias()
Returns whether the
@noalias annotation is present on this
JSDocInfo. |
boolean |
isNoCollapse()
Returns whether the
@nocompile annotation is present on this
JSDocInfo. |
boolean |
isNoCompile()
Returns whether the
@nocompile annotation is present on this
JSDocInfo. |
boolean |
isNoSideEffects()
Returns whether the
@nosideeffects annotation is present on this
JSDocInfo. |
boolean |
isOverride()
Returns whether the
@override annotation is present on this
JSDocInfo. |
boolean |
isPolymerBehavior()
Returns whether JSDoc is annotated with
@polymerBehavior annotation. |
boolean |
isStableIdGenerator() |
boolean |
isWizaction()
Returns whether JSDoc is annotated with
@wizaction annotation. |
boolean |
makesDicts()
Returns whether the
@dict annotation is present on this
JSDocInfo. |
boolean |
makesStructs()
Returns whether the
@struct annotation is present on this
JSDocInfo. |
boolean |
makesUnrestricted()
Returns whether the
@unrestricted annotation is present on this
JSDocInfo. |
boolean |
shouldPreserveTry()
Returns whether the
@preserveTry annotation is present on this
JSDocInfo. |
String |
toString() |
String |
toStringVerbose() |
boolean |
usesImplicitMatch()
Returns whether the
@record annotation is present on this
JSDocInfo. |
public boolean isConsistentIdGenerator()
@consistentIdGenerator is present on
this JSDocInfopublic boolean isStableIdGenerator()
@stableIdGenerator is present on this JSDocInfo.public boolean isMappedIdGenerator()
@stableIdGenerator is present on this JSDocInfo.public boolean isConstant()
@const annotation is present on this
JSDocInfo.public boolean hasConstAnnotation()
public boolean isConstructor()
@constructor annotation is present on this
JSDocInfo.public boolean usesImplicitMatch()
@record annotation is present on this
JSDocInfo.public boolean makesUnrestricted()
@unrestricted annotation is present on this
JSDocInfo.public boolean makesStructs()
@struct annotation is present on this
JSDocInfo.public boolean makesDicts()
@dict annotation is present on this
JSDocInfo.public boolean isDefine()
public boolean isHidden()
@hidden annotation is present on this
JSDocInfo.public boolean shouldPreserveTry()
@preserveTry annotation is present on this
JSDocInfo.public boolean isOverride()
@override annotation is present on this
JSDocInfo.public boolean isNoAlias()
@noalias annotation is present on this
JSDocInfo.public boolean isDeprecated()
@deprecated annotation is present on this
JSDocInfo.public boolean isInterface()
@interface annotation is present on this
JSDocInfo.public boolean isConstructorOrInterface()
public boolean isExport()
@export annotation is present on this
JSDocInfo.public boolean isExpose()
@expose annotation is present on this
JSDocInfo.public boolean isIdGenerator()
@idGenerator is present on
this JSDocInfopublic boolean isImplicitCast()
@implicitCast annotation is present on this
JSDocInfo.public boolean isNoSideEffects()
@nosideeffects annotation is present on this
JSDocInfo.public boolean isExterns()
@externs annotation is present on this
JSDocInfo.public boolean isNoCompile()
@nocompile annotation is present on this
JSDocInfo.public boolean isNoCollapse()
@nocompile annotation is present on this
JSDocInfo.public boolean containsDeclaration()
JSDocInfo.public boolean containsFunctionDeclaration()
public JSDocInfo.Visibility getVisibility()
@private, @protected or
@public annotation. If no visibility is specified, visibility
is inherited from the base class.public JSTypeExpression getParameterType(String parameter)
parameter - the parameter's namenull if this parameter is not
defined or has a null typepublic boolean hasParameter(String parameter)
public boolean hasParameterType(String parameter)
true if the parameter has an attached type, false
if the parameter has no attached type or does not exist.public Set<String> getParameterNames()
public int getParameterCount()
public List<JSTypeExpression> getThrownTypes()
public boolean hasType()
@type annotation, is
present on this JSDoc.public boolean hasEnumParameterType()
@enum
annotation, is present on this JSDoc.public boolean hasTypedefType()
@typedef annotation, is present on this JSDoc.public boolean hasReturnType()
JSDocInfo contains a type for @return
annotation.public boolean hasTypeInformation()
public JSTypeExpression getType()
@type annotation.public boolean isInlineType()
public JSTypeExpression getReturnType()
@return annotation.public JSTypeExpression getEnumParameterType()
@enum annotation.public JSTypeExpression getTypedefType()
@type annotation.public JSTypeExpression getThisType()
@this annotation.public boolean hasThisType()
JSDocInfo contains a type for @this
annotation.public JSTypeExpression getBaseType()
@extends annotation.public String getDescription()
@desc annotation.public String getMeaning()
@meaning annotation.
In localization systems, two messages with the same content but different "meanings" may be translated differently. By default, we use the name of the variable that the message is initialized to as the "meaning" of the message.
But some code generators (like Closure Templates) inject their own
meaning with the jsdoc @meaning annotation.
public String getLendsName()
@lends annotation.
In many reflection APIs, you pass an anonymous object to a function,
and that function mixes the anonymous object into another object.
The @lends annotation allows the type system to track
those property assignments.
public boolean isNgInject()
@ngInject annotation.public boolean isJaggerInject()
@jaggerInject annotation.public boolean isJaggerProvide()
@jaggerProvidePromise annotation.public boolean isJaggerProvidePromise()
@jaggerProvidePromise annotation.public boolean isJaggerModule()
@jaggerModule annotation.public boolean isWizaction()
@wizaction annotation.public boolean isPolymerBehavior()
@polymerBehavior annotation.public boolean isDisposes()
@disposes annotation.public boolean disposesOf(String parameterName)
public String getLicense()
@license annotation.public String toStringVerbose()
public boolean hasBaseType()
JSDocInfo contains a type for @extends
annotation.public List<JSTypeExpression> getImplementedInterfaces()
@implements annotation.public int getImplementedInterfaceCount()
@implements
annotation.public List<JSTypeExpression> getExtendedInterfaces()
public int getExtendedInterfacesCount()
public String getDeprecationReason()
public boolean hasDescriptionForParameter(String name)
public String getDescriptionForParameter(String name)
public Collection<String> getAuthors()
public Collection<String> getReferences()
public String getVersion()
public String getReturnDescription()
public String getBlockDescription()
public boolean hasFileOverview()
public String getFileOverview()
public Collection<JSDocInfo.Marker> getMarkers()
public com.google.common.collect.ImmutableList<String> getTemplateTypeNames()
public com.google.common.collect.ImmutableMap<String,Node> getTypeTransformations()
public Collection<Node> getTypeNodes()
public boolean hasModifies()
public String getOriginalCommentString()
public int getOriginalCommentPosition()
Copyright © 2009-2015 Google. All Rights Reserved.