Class SimpleGroovyDoc
java.lang.Object
org.codehaus.groovy.tools.groovydoc.SimpleGroovyDoc
- All Implemented Interfaces:
Comparable<GroovyDoc>,GroovyDoc
- Direct Known Subclasses:
SimpleGroovyPackageDoc,SimpleGroovyProgramElementDoc,SimpleGroovyRootDoc
Base implementation of the
GroovyDoc contract.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intToken type used for annotation types.static final intToken type used for ordinary classes.static final intToken type used for enums.static final intToken type used for interfaces.static final intToken type used for records.static final intToken type used for traits. -
Constructor Summary
ConstructorsConstructorDescriptionSimpleGroovyDoc(String name) Creates a documented element with the supplied name. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringExtracts the first sentence from a raw documentation comment.Returns the processed comment text for this element.intReturns the first sentence of the processed comment text.Returns the raw documentation comment for this element.Returns a human-readable description of this element's kind.Returns the source-level keyword used to declare this element.booleanIndicates whether this element represents an annotation type.booleanIndicates whether this element represents an annotation type member.booleanisClass()Indicates whether this element represents a class.booleanIndicates whether this element represents a constructor.booleanIndicates whether this element is marked as deprecated.booleanisEnum()Indicates whether this element represents an enum type.booleanIndicates whether this element represents an enum constant.booleanisError()Indicates whether this element represents an error type.booleanIndicates whether this element represents an exception type.booleanisField()Indicates whether this element represents a field.booleanisHidden()Indicates whether this doc element should be retained for internal model lookups but excluded from rendered output.booleanIndicates whether this element is included in the generated output.booleanIndicates whether this element represents an interface.booleanIndicates whether this documentation comment should be rendered as Markdown.booleanisMethod()Indicates whether this element represents a method.booleanIndicates whether this element represents an ordinary class.booleanisRecord()Indicates whether this element represents a record type.booleanisScript()Indicates whether this documented element represents a Groovy script.booleanisTrait()Indicates whether this documented element represents a trait.name()Returns the simple name of this documented element.protected voidsetCommentText(String commentText) Stores the rendered comment text for this element.voidsetDeprecated(boolean deprecated) Marks this documented element as deprecated or not deprecated.protected voidsetFirstSentenceCommentText(String firstSentenceCommentText) Stores the first-sentence summary for this element.voidsetHidden(boolean hidden) Sets whether this doc element should be hidden from rendered output while remaining available for internal resolution such asinheritDoc.voidsetMarkdown(boolean markdown) Sets whether this documentation comment should be rendered as Markdown.voidsetRawCommentText(String rawCommentText) Replaces the raw documentation comment for this element.voidsetScript(boolean script) Marks this documented element as a script or ordinary class.voidsetTokenType(int t) Sets the parsed token type for this element.tags()Returns the block tags parsed from the raw comment text.intReturns the parsed token type for this element.toString()Returns a debug-friendly representation of this documented element.
-
Field Details
-
CLASS_DEF
public static final int CLASS_DEFToken type used for ordinary classes.- See Also:
-
TRAIT_DEF
public static final int TRAIT_DEFToken type used for traits.- See Also:
-
INTERFACE_DEF
public static final int INTERFACE_DEFToken type used for interfaces.- See Also:
-
RECORD_DEF
public static final int RECORD_DEFToken type used for records.- See Also:
-
ANNOTATION_DEF
public static final int ANNOTATION_DEFToken type used for annotation types.- See Also:
-
ENUM_DEF
public static final int ENUM_DEFToken type used for enums.- See Also:
-
-
Constructor Details
-
SimpleGroovyDoc
Creates a documented element with the supplied name.- Parameters:
name- the element name
-
-
Method Details
-
name
Returns the simple name of this documented element. -
toString
Returns a debug-friendly representation of this documented element. -
setCommentText
Stores the rendered comment text for this element.- Parameters:
commentText- the rendered comment text
-
setFirstSentenceCommentText
Stores the first-sentence summary for this element.- Parameters:
firstSentenceCommentText- the summary text
-
commentText
Returns the processed comment text for this element.- Specified by:
commentTextin interfaceGroovyDoc- Returns:
- the rendered comment text
-
firstSentenceCommentText
Returns the first sentence of the processed comment text.- Specified by:
firstSentenceCommentTextin interfaceGroovyDoc- Returns:
- the first sentence summary
-
getRawCommentText
Returns the raw documentation comment for this element.- Specified by:
getRawCommentTextin interfaceGroovyDoc- Returns:
- the raw comment text
-
setRawCommentText
Replaces the raw documentation comment for this element.- Specified by:
setRawCommentTextin interfaceGroovyDoc- Parameters:
rawCommentText- the raw comment text to store
-
isMarkdown
public boolean isMarkdown()Indicates whether this documentation comment should be rendered as Markdown.- Returns:
trueif Markdown rendering is enabled- Since:
- 6.0.0
-
setMarkdown
public void setMarkdown(boolean markdown) Sets whether this documentation comment should be rendered as Markdown.- Parameters:
markdown-trueto enable Markdown rendering- Since:
- 6.0.0
-
isHidden
public boolean isHidden()Indicates whether this doc element should be retained for internal model lookups but excluded from rendered output.- Returns:
trueif this element is hidden from published docs- Since:
- 6.0.0
-
setHidden
public void setHidden(boolean hidden) Sets whether this doc element should be hidden from rendered output while remaining available for internal resolution such asinheritDoc.- Parameters:
hidden-trueif this element should be hidden- Since:
- 6.0.0
-
setScript
public void setScript(boolean script) Marks this documented element as a script or ordinary class.- Parameters:
script-trueif this element represents a script
-
calculateFirstSentence
Extracts the first sentence from a raw documentation comment.- Parameters:
raw- the raw documentation comment- Returns:
- the calculated first sentence
-
isClass
public boolean isClass()Indicates whether this element represents a class. -
isScript
public boolean isScript()Indicates whether this documented element represents a Groovy script.- Returns:
trueif this element is a script
-
isTrait
public boolean isTrait()Indicates whether this documented element represents a trait.- Returns:
trueif this element is a trait
-
isInterface
public boolean isInterface()Indicates whether this element represents an interface.- Specified by:
isInterfacein interfaceGroovyDoc- Returns:
trueif this element is an interface
-
isAnnotationType
public boolean isAnnotationType()Indicates whether this element represents an annotation type.- Specified by:
isAnnotationTypein interfaceGroovyDoc- Returns:
trueif this element is an annotation type
-
isEnum
public boolean isEnum()Indicates whether this element represents an enum type. -
isRecord
public boolean isRecord()Indicates whether this element represents a record type. -
getTypeDescription
Returns a human-readable description of this element's kind.- Returns:
- the element kind description
-
getTypeSourceDescription
Returns the source-level keyword used to declare this element.- Returns:
- the declaration keyword or descriptor
-
setTokenType
public void setTokenType(int t) Sets the parsed token type for this element.- Parameters:
t- the token type
-
tokenType
public int tokenType()Returns the parsed token type for this element.- Returns:
- the token type
-
compareTo
- Specified by:
compareToin interfaceComparable<GroovyDoc>
-
isAnnotationTypeElement
public boolean isAnnotationTypeElement()Indicates whether this element represents an annotation type member.- Specified by:
isAnnotationTypeElementin interfaceGroovyDoc- Returns:
trueif this element is an annotation type element
-
isConstructor
public boolean isConstructor()Indicates whether this element represents a constructor.- Specified by:
isConstructorin interfaceGroovyDoc- Returns:
trueif this element is a constructor
-
isEnumConstant
public boolean isEnumConstant()Indicates whether this element represents an enum constant.- Specified by:
isEnumConstantin interfaceGroovyDoc- Returns:
trueif this element is an enum constant
-
isDeprecated
public boolean isDeprecated()Indicates whether this element is marked as deprecated.- Specified by:
isDeprecatedin interfaceGroovyDoc- Returns:
trueif this element is deprecated
-
isError
public boolean isError()Indicates whether this element represents an error type. -
isException
public boolean isException()Indicates whether this element represents an exception type.- Specified by:
isExceptionin interfaceGroovyDoc- Returns:
trueif this element is an exception
-
isField
public boolean isField()Indicates whether this element represents a field. -
isIncluded
public boolean isIncluded()Indicates whether this element is included in the generated output.- Specified by:
isIncludedin interfaceGroovyDoc- Returns:
trueif this element is included
-
isMethod
public boolean isMethod()Indicates whether this element represents a method. -
isOrdinaryClass
public boolean isOrdinaryClass()Indicates whether this element represents an ordinary class.- Specified by:
isOrdinaryClassin interfaceGroovyDoc- Returns:
trueif this element is an ordinary class
-
tags
Returns the block tags parsed from the raw comment text.- Returns:
- a defensive copy of the parsed tags, or
nullif tags have not been calculated
-
setDeprecated
public void setDeprecated(boolean deprecated) Marks this documented element as deprecated or not deprecated.- Parameters:
deprecated-trueif the element is deprecated
-