Class SimpleGroovyDoc

java.lang.Object
org.codehaus.groovy.tools.groovydoc.SimpleGroovyDoc
All Implemented Interfaces:
Comparable<GroovyDoc>, GroovyDoc
Direct Known Subclasses:
SimpleGroovyPackageDoc, SimpleGroovyProgramElementDoc, SimpleGroovyRootDoc

public class SimpleGroovyDoc extends Object implements GroovyDoc
Base implementation of the GroovyDoc contract.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Token type used for annotation types.
    static final int
    Token type used for ordinary classes.
    static final int
    Token type used for enums.
    static final int
    Token type used for interfaces.
    static final int
    Token type used for records.
    static final int
    Token type used for traits.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a documented element with the supplied name.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    Extracts the first sentence from a raw documentation comment.
    Returns the processed comment text for this element.
    int
    Returns 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.
    boolean
    Indicates whether this element represents an annotation type.
    boolean
    Indicates whether this element represents an annotation type member.
    boolean
    Indicates whether this element represents a class.
    boolean
    Indicates whether this element represents a constructor.
    boolean
    Indicates whether this element is marked as deprecated.
    boolean
    Indicates whether this element represents an enum type.
    boolean
    Indicates whether this element represents an enum constant.
    boolean
    Indicates whether this element represents an error type.
    boolean
    Indicates whether this element represents an exception type.
    boolean
    Indicates whether this element represents a field.
    boolean
    Indicates whether this doc element should be retained for internal model lookups but excluded from rendered output.
    boolean
    Indicates whether this element is included in the generated output.
    boolean
    Indicates whether this element represents an interface.
    boolean
    Indicates whether this documentation comment should be rendered as Markdown.
    boolean
    Indicates whether this element represents a method.
    boolean
    Indicates whether this element represents an ordinary class.
    boolean
    Indicates whether this element represents a record type.
    boolean
    Indicates whether this documented element represents a Groovy script.
    boolean
    Indicates whether this documented element represents a trait.
    Returns the simple name of this documented element.
    protected void
    setCommentText(String commentText)
    Stores the rendered comment text for this element.
    void
    setDeprecated(boolean deprecated)
    Marks this documented element as deprecated or not deprecated.
    protected void
    setFirstSentenceCommentText(String firstSentenceCommentText)
    Stores the first-sentence summary for this element.
    void
    setHidden(boolean hidden)
    Sets whether this doc element should be hidden from rendered output while remaining available for internal resolution such as inheritDoc.
    void
    setMarkdown(boolean markdown)
    Sets whether this documentation comment should be rendered as Markdown.
    void
    setRawCommentText(String rawCommentText)
    Replaces the raw documentation comment for this element.
    void
    setScript(boolean script)
    Marks this documented element as a script or ordinary class.
    void
    setTokenType(int t)
    Sets the parsed token type for this element.
    Returns the block tags parsed from the raw comment text.
    int
    Returns the parsed token type for this element.
    Returns a debug-friendly representation of this documented element.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • CLASS_DEF

      public static final int CLASS_DEF
      Token type used for ordinary classes.
      See Also:
    • TRAIT_DEF

      public static final int TRAIT_DEF
      Token type used for traits.
      See Also:
    • INTERFACE_DEF

      public static final int INTERFACE_DEF
      Token type used for interfaces.
      See Also:
    • RECORD_DEF

      public static final int RECORD_DEF
      Token type used for records.
      See Also:
    • ANNOTATION_DEF

      public static final int ANNOTATION_DEF
      Token type used for annotation types.
      See Also:
    • ENUM_DEF

      public static final int ENUM_DEF
      Token type used for enums.
      See Also:
  • Constructor Details

    • SimpleGroovyDoc

      public SimpleGroovyDoc(String name)
      Creates a documented element with the supplied name.
      Parameters:
      name - the element name
  • Method Details

    • name

      public String name()
      Returns the simple name of this documented element.
      Specified by:
      name in interface GroovyDoc
      Returns:
      the element name
    • toString

      public String toString()
      Returns a debug-friendly representation of this documented element.
      Overrides:
      toString in class Object
      Returns:
      the string form of this element
    • setCommentText

      protected void setCommentText(String commentText)
      Stores the rendered comment text for this element.
      Parameters:
      commentText - the rendered comment text
    • setFirstSentenceCommentText

      protected void setFirstSentenceCommentText(String firstSentenceCommentText)
      Stores the first-sentence summary for this element.
      Parameters:
      firstSentenceCommentText - the summary text
    • commentText

      public String commentText()
      Returns the processed comment text for this element.
      Specified by:
      commentText in interface GroovyDoc
      Returns:
      the rendered comment text
    • firstSentenceCommentText

      public String firstSentenceCommentText()
      Returns the first sentence of the processed comment text.
      Specified by:
      firstSentenceCommentText in interface GroovyDoc
      Returns:
      the first sentence summary
    • getRawCommentText

      public String getRawCommentText()
      Returns the raw documentation comment for this element.
      Specified by:
      getRawCommentText in interface GroovyDoc
      Returns:
      the raw comment text
    • setRawCommentText

      public void setRawCommentText(String rawCommentText)
      Replaces the raw documentation comment for this element.
      Specified by:
      setRawCommentText in interface GroovyDoc
      Parameters:
      rawCommentText - the raw comment text to store
    • isMarkdown

      public boolean isMarkdown()
      Indicates whether this documentation comment should be rendered as Markdown.
      Returns:
      true if 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 - true to 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:
      true if 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 as inheritDoc.
      Parameters:
      hidden - true if 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 - true if this element represents a script
    • calculateFirstSentence

      public static String calculateFirstSentence(String raw)
      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.
      Specified by:
      isClass in interface GroovyDoc
      Returns:
      true if this element is a class
    • isScript

      public boolean isScript()
      Indicates whether this documented element represents a Groovy script.
      Returns:
      true if this element is a script
    • isTrait

      public boolean isTrait()
      Indicates whether this documented element represents a trait.
      Returns:
      true if this element is a trait
    • isInterface

      public boolean isInterface()
      Indicates whether this element represents an interface.
      Specified by:
      isInterface in interface GroovyDoc
      Returns:
      true if this element is an interface
    • isAnnotationType

      public boolean isAnnotationType()
      Indicates whether this element represents an annotation type.
      Specified by:
      isAnnotationType in interface GroovyDoc
      Returns:
      true if this element is an annotation type
    • isEnum

      public boolean isEnum()
      Indicates whether this element represents an enum type.
      Specified by:
      isEnum in interface GroovyDoc
      Returns:
      true if this element is an enum
    • isRecord

      public boolean isRecord()
      Indicates whether this element represents a record type.
      Specified by:
      isRecord in interface GroovyDoc
      Returns:
      true if this element is a record
    • getTypeDescription

      public String getTypeDescription()
      Returns a human-readable description of this element's kind.
      Returns:
      the element kind description
    • getTypeSourceDescription

      public String 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

      public int compareTo(GroovyDoc that)
      Specified by:
      compareTo in interface Comparable<GroovyDoc>
    • isAnnotationTypeElement

      public boolean isAnnotationTypeElement()
      Indicates whether this element represents an annotation type member.
      Specified by:
      isAnnotationTypeElement in interface GroovyDoc
      Returns:
      true if this element is an annotation type element
    • isConstructor

      public boolean isConstructor()
      Indicates whether this element represents a constructor.
      Specified by:
      isConstructor in interface GroovyDoc
      Returns:
      true if this element is a constructor
    • isEnumConstant

      public boolean isEnumConstant()
      Indicates whether this element represents an enum constant.
      Specified by:
      isEnumConstant in interface GroovyDoc
      Returns:
      true if this element is an enum constant
    • isDeprecated

      public boolean isDeprecated()
      Indicates whether this element is marked as deprecated.
      Specified by:
      isDeprecated in interface GroovyDoc
      Returns:
      true if this element is deprecated
    • isError

      public boolean isError()
      Indicates whether this element represents an error type.
      Specified by:
      isError in interface GroovyDoc
      Returns:
      true if this element is an error
    • isException

      public boolean isException()
      Indicates whether this element represents an exception type.
      Specified by:
      isException in interface GroovyDoc
      Returns:
      true if this element is an exception
    • isField

      public boolean isField()
      Indicates whether this element represents a field.
      Specified by:
      isField in interface GroovyDoc
      Returns:
      true if this element is a field
    • isIncluded

      public boolean isIncluded()
      Indicates whether this element is included in the generated output.
      Specified by:
      isIncluded in interface GroovyDoc
      Returns:
      true if this element is included
    • isMethod

      public boolean isMethod()
      Indicates whether this element represents a method.
      Specified by:
      isMethod in interface GroovyDoc
      Returns:
      true if this element is a method
    • isOrdinaryClass

      public boolean isOrdinaryClass()
      Indicates whether this element represents an ordinary class.
      Specified by:
      isOrdinaryClass in interface GroovyDoc
      Returns:
      true if this element is an ordinary class
    • tags

      public GroovyTag[] tags()
      Returns the block tags parsed from the raw comment text.
      Returns:
      a defensive copy of the parsed tags, or null if tags have not been calculated
    • setDeprecated

      public void setDeprecated(boolean deprecated)
      Marks this documented element as deprecated or not deprecated.
      Parameters:
      deprecated - true if the element is deprecated