|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.javascript.rhino.JSDocInfo
public class JSDocInfo
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.
Nested Class Summary | |
---|---|
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. |
Constructor Summary | |
---|---|
JSDocInfo()
|
Method Summary | |
---|---|
void |
addSuppression(String suppression)
Add a suppressed warning. |
boolean |
containsDeclaration()
|
Node |
getAssociatedNode()
|
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. |
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. |
String |
getSourceName()
Gets the name of the source file that contains this JSDoc. |
Set<String> |
getSuppressions()
Returns the set of suppressed warnings. |
String |
getTemplateTypeName()
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. |
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 |
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 |
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 |
isDefine()
Returns whether the @define annotation is present on this
JSDocInfo . |
boolean |
isDeprecated()
Returns whether the @deprecated annotation is present on this
JSDocInfo . |
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 |
isInterface()
Returns whether the @interface annotation is present on this
JSDocInfo . |
boolean |
isJavaDispatch()
Returns whether the @javadispath annotation is present on this
JSDocInfo . |
boolean |
isNoAlias()
Returns whether the @noalias annotation is present on this
JSDocInfo . |
boolean |
isNoCompile()
Returns whether the @nocompile annotation is present on this
JSDocInfo . |
boolean |
isNoShadow()
Returns whether the @noshadow annotation is present on this
JSDocInfo . |
boolean |
isNoSideEffects()
Returns whether the @nosideeffects annotation is present on this
JSDocInfo . |
boolean |
isNoTypeCheck()
Returns whether the @nocheck annotation is present on this
JSDocInfo . |
boolean |
isOverride()
Returns whether the @override annotation is present on this
JSDocInfo . |
void |
setAssociatedNode(Node node)
Sets the node associated with this JSDoc. |
void |
setDeprecated(boolean value)
|
void |
setLicense(String license)
License directives can appear in multiple comments, and always apply to the entire file. |
void |
setVisibility(JSDocInfo.Visibility visibility)
|
boolean |
shouldPreserveTry()
Returns whether the @preserveTry annotation is present on this
JSDocInfo . |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JSDocInfo()
Method Detail |
---|
public void setDeprecated(boolean value)
public boolean isConsistentIdGenerator()
@consistentIdGenerator
is present on
this JSDocInfo
public boolean isConstant()
@const
annotation is present on this
JSDocInfo
.
public boolean isConstructor()
@constructor
annotation is present on this
JSDocInfo
.
public boolean isDefine()
@define
annotation is present on this
JSDocInfo
. If this annotation is present, then the
getType()
method will retrieve the define type.
public boolean isHidden()
@hidden
annotation is present on this
JSDocInfo
.
public boolean isNoTypeCheck()
@nocheck
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 isExport()
@export
annotation is present on this
JSDocInfo
.
public boolean isExpose()
@expose
annotation is present on this
JSDocInfo
.
public boolean isNoShadow()
@noshadow
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 isJavaDispatch()
@javadispath
annotation is present on this
JSDocInfo
.
public boolean isNoCompile()
@nocompile
annotation is present on this
JSDocInfo
.
public boolean containsDeclaration()
JSDocInfo
.public void setVisibility(JSDocInfo.Visibility visibility)
public void addSuppression(String suppression)
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 name
null
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 JSTypeExpression getType()
@type
annotation.
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 String getLicense()
@license
annotation.
public void setLicense(String license)
license
- String containing new license text.public String toString()
toString
in class Object
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 Set<String> getSuppressions()
public Set<String> getModifies()
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 Node getAssociatedNode()
public void setAssociatedNode(Node node)
public String getSourceName()
public Collection<JSDocInfo.Marker> getMarkers()
public String getTemplateTypeName()
public Collection<Node> getTypeNodes()
public boolean hasModifies()
public String getOriginalCommentString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |