public class JSDocInfo
extends java.lang.Object
implements java.io.Serializable
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() |
JSDocInfo |
clone(boolean cloneTypeNodes) |
boolean |
containsDeclaration() |
boolean |
containsFunctionDeclaration()
Deprecated.
This method is quite heuristic, looking for @type annotations that start with
"function". Other methods like containsDeclaration() and containsTypeDefinition are generally
preferred.
|
boolean |
containsTypeDefinition() |
boolean |
disposesOf(java.lang.String parameterName)
Return whether the function disposes of specified parameter.
|
java.util.Collection<java.lang.String> |
getAuthors()
Returns the list of authors or null if none.
|
JSTypeExpression |
getBaseType()
Gets the base type specified by the
@extends annotation. |
java.lang.String |
getBlockDescription()
Returns the block-level description or null if none specified.
|
java.lang.String |
getDeprecationReason()
Returns the deprecation reason or null if none specified.
|
java.lang.String |
getDescription()
Gets the description specified by the
@desc annotation. |
java.lang.String |
getDescriptionForParameter(java.lang.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. |
java.util.List<JSTypeExpression> |
getExtendedInterfaces()
Returns the interfaces extended by an interface
|
int |
getExtendedInterfacesCount()
Gets the number of extended interfaces specified
|
java.lang.String |
getFileOverview()
Returns the file overview or null if none specified.
|
int |
getImplementedInterfaceCount()
Gets the number of interfaces specified by the
@implements
annotation. |
java.util.List<JSTypeExpression> |
getImplementedInterfaces()
Returns the types specified by the
@implements annotation. |
JSTypeExpression |
getLendsName()
Gets the name we're lending to in a
@lends annotation. |
java.lang.String |
getLicense()
Gets the description specified by the
@license annotation. |
java.util.Collection<JSDocInfo.Marker> |
getMarkers()
Gets the list of all markers for the documentation in this JSDoc.
|
java.lang.String |
getMeaning()
Gets the meaning specified by the
@meaning annotation. |
java.util.Set<java.lang.String> |
getModifies()
Returns the set of sideeffect notations.
|
int |
getOriginalCommentPosition() |
java.lang.String |
getOriginalCommentString()
Returns the original JSDoc comment string.
|
int |
getParameterCount()
Gets the number of parameters defined.
|
java.lang.String |
getParameterNameAt(int index)
Returns the nth name in the defined parameters.
|
java.util.Set<java.lang.String> |
getParameterNames()
Returns the set of names of the defined parameters.
|
JSTypeExpression |
getParameterType(java.lang.String parameter)
Gets the type of a given named parameter.
|
java.util.Collection<java.lang.String> |
getReferences()
Returns the list of references or null if none.
|
java.lang.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. |
java.util.Set<java.lang.String> |
getSuppressions()
Returns the set of suppressed warnings.
|
com.google.common.collect.ImmutableList<java.lang.String> |
getTemplateTypeNames()
Gets the template type name.
|
JSTypeExpression |
getThisType()
Gets the type specified by the
@this annotation. |
java.util.List<JSTypeExpression> |
getThrownTypes()
Returns the list of thrown types.
|
java.lang.String |
getThrowsDescriptionForType(JSTypeExpression type)
Get the message for a given thrown type.
|
JSTypeExpression |
getType()
Gets the type specified by the
@type annotation. |
JSTypeExpression |
getTypedefType()
Gets the typedef type specified by the
@type annotation. |
java.util.Collection<Node> |
getTypeNodes()
Returns a collection of all type nodes that are a part of this JSDocInfo.
|
com.google.common.collect.ImmutableMap<java.lang.String,Node> |
getTypeTransformations()
Gets the type transformations.
|
java.lang.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()
Returns whether the
@const annotation is present on this JSDocInfo . |
boolean |
hasDescriptionForParameter(java.lang.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 |
hasLendsName() |
boolean |
hasModifies() |
boolean |
hasParameter(java.lang.String parameter)
Returns whether the parameter is defined.
|
boolean |
hasParameterType(java.lang.String parameter)
Returns whether the parameter has an attached type.
|
boolean |
hasReturnType()
Returns whether this
JSDocInfo contains a type for @return
annotation. |
boolean |
hasSideEffectsArgumentsAnnotation() |
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 |
isAbstract()
Returns whether the
@abstract annotation is present on this
JSDocInfo . |
boolean |
isAtSignCodePresent() |
boolean |
isConsistentIdGenerator() |
boolean |
isConstant() |
boolean |
isConstructor()
Returns whether the
@constructor annotation is present on this
JSDocInfo . |
boolean |
isConstructorOrInterface() |
boolean |
isCustomElement()
Returns whether JSDoc is annotated with
@customElement annotation. |
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 |
isFinal()
Returns whether the
@final 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 |
isMappedIdGenerator() |
boolean |
isMixinClass()
Returns whether JSDoc is annotated with
@mixinClass annotation. |
boolean |
isMixinFunction()
Returns whether JSDoc is annotated with
@mixinFunction annotation. |
boolean |
isNgInject()
Returns whether JSDoc is annotated with
@ngInject annotation. |
boolean |
isNoCollapse()
Returns whether the
@nocollapse annotation is present on this
JSDocInfo . |
boolean |
isNoCompile()
Returns whether the
@nocompile annotation is present on this
JSDocInfo . |
boolean |
isNoInline()
Returns whether the
@noinline 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 |
isPolymer()
Returns whether JSDoc is annotated with
@polymer annotation. |
boolean |
isPolymerBehavior()
Returns whether JSDoc is annotated with
@polymerBehavior annotation. |
boolean |
isStableIdGenerator() |
boolean |
isTypeSummary()
Returns whether the
@typeSummary annotation is present on this
JSDocInfo . |
boolean |
isWizaction()
Returns whether JSDoc is annotated with
@wizaction annotation. |
boolean |
isXidGenerator() |
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 |
modifiesThis()
Get the value of the @modifies{this} annotation stored in the doc info.
|
java.lang.String |
toString() |
java.lang.String |
toStringVerbose() |
boolean |
usesImplicitMatch()
Returns whether the
@record annotation is present on this
JSDocInfo . |
public JSDocInfo clone()
clone
in class java.lang.Object
public JSDocInfo clone(boolean cloneTypeNodes)
public boolean isConsistentIdGenerator()
@consistentIdGenerator
is present on
this JSDocInfo
public boolean isStableIdGenerator()
@stableIdGenerator
is present on this JSDocInfo
.public boolean isXidGenerator()
@idGenerator {xid}
is present on this JSDocInfo
.public boolean isMappedIdGenerator()
@idGenerator {mapped}
is present on this JSDocInfo
.public boolean isConstant()
JSDocInfo
implies that annotated value is constant.public boolean hasConstAnnotation()
@const
annotation is present on this JSDocInfo
.public boolean isFinal()
@final
annotation is present on this JSDocInfo
.public boolean isConstructor()
@constructor
annotation is present on this
JSDocInfo
.public boolean isAbstract()
@abstract
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 isOverride()
@override
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 JSDocInfo
public 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 isTypeSummary()
@typeSummary
annotation is present on this
JSDocInfo
.public boolean isNoCompile()
@nocompile
annotation is present on this
JSDocInfo
.public boolean isNoCollapse()
@nocollapse
annotation is present on this
JSDocInfo
.public boolean isNoInline()
@noinline
annotation is present on this
JSDocInfo
.public boolean containsDeclaration()
JSDocInfo
.@Deprecated public boolean containsFunctionDeclaration()
public boolean containsTypeDefinition()
public boolean isAtSignCodePresent()
@code
is present within this JSDocInfo
.public JSDocInfo.Visibility getVisibility()
@private
, @protected
or
@public
annotation. If no visibility is specified, visibility
is inherited from the base class.public JSTypeExpression getParameterType(java.lang.String parameter)
parameter
- the parameter's namenull
if this parameter is not
defined or has a null
typepublic boolean hasParameter(java.lang.String parameter)
public boolean hasParameterType(java.lang.String parameter)
true
if the parameter has an attached type, false
if the parameter has no attached type or does not exist.public java.util.Set<java.lang.String> getParameterNames()
public java.lang.String getParameterNameAt(int index)
public int getParameterCount()
public java.util.List<JSTypeExpression> getThrownTypes()
public java.lang.String getThrowsDescriptionForType(JSTypeExpression type)
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 hasType()
@type
annotation, is
present on this JSDoc.public boolean hasTypeInformation()
public boolean isInlineType()
public JSTypeExpression getReturnType()
@return
annotation.public JSTypeExpression getEnumParameterType()
@enum
annotation.public JSTypeExpression getTypedefType()
@type
annotation.public JSTypeExpression getType()
@type
annotation.public JSTypeExpression getThisType()
@this
annotation.public boolean hasThisType()
JSDocInfo
contains a type for @this
annotation.public JSTypeExpression getBaseType()
@extends
annotation.public java.lang.String getDescription()
@desc
annotation.public java.lang.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 JSTypeExpression 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 hasLendsName()
public boolean isNgInject()
@ngInject
annotation.public boolean isWizaction()
@wizaction
annotation.public boolean isPolymerBehavior()
@polymerBehavior
annotation.public boolean isPolymer()
@polymer
annotation.public boolean isCustomElement()
@customElement
annotation.public boolean isMixinClass()
@mixinClass
annotation.public boolean isMixinFunction()
@mixinFunction
annotation.public boolean isDisposes()
@disposes
annotation.public boolean disposesOf(java.lang.String parameterName)
public java.lang.String getLicense()
@license
annotation.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toStringVerbose()
public boolean hasBaseType()
JSDocInfo
contains a type for @extends
annotation.public java.util.List<JSTypeExpression> getImplementedInterfaces()
@implements
annotation.public int getImplementedInterfaceCount()
@implements
annotation.public java.util.List<JSTypeExpression> getExtendedInterfaces()
public int getExtendedInterfacesCount()
public java.lang.String getDeprecationReason()
public java.util.Set<java.lang.String> getSuppressions()
public java.util.Set<java.lang.String> getModifies()
public boolean hasDescriptionForParameter(java.lang.String name)
public java.lang.String getDescriptionForParameter(java.lang.String name)
public java.util.Collection<java.lang.String> getAuthors()
public java.util.Collection<java.lang.String> getReferences()
public java.lang.String getVersion()
public java.lang.String getReturnDescription()
public java.lang.String getBlockDescription()
public boolean hasFileOverview()
public java.lang.String getFileOverview()
public java.util.Collection<JSDocInfo.Marker> getMarkers()
public com.google.common.collect.ImmutableList<java.lang.String> getTemplateTypeNames()
public com.google.common.collect.ImmutableMap<java.lang.String,Node> getTypeTransformations()
public java.util.Collection<Node> getTypeNodes()
public boolean hasModifies()
public java.lang.String getOriginalCommentString()
public int getOriginalCommentPosition()
public boolean modifiesThis()
public boolean hasSideEffectsArgumentsAnnotation()
Copyright © 2009-2019 Google. All Rights Reserved.