Package: org.codehaus.groovy.tools.groovydoc

## [Java] Class SimpleGroovyClassDoc

- org.codehaus.groovy.tools.groovydoc.SimpleGroovyClassDoc

- All Implemented Interfaces and Traits:
    GroovyClassDoc

      public class SimpleGroovyClassDoc
      extends SimpleGroovyAbstractableElementDoc
      implements GroovyClassDoc

  Default GroovyClassDoc implementation for classes parsed from Groovy or Java source.

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static Pattern` | `CODE_REGEX` | Pattern used to locate `{@code ...`} style inline tags for angle-bracket escaping.
    `static String` | `DOCROOT_PATTERN` | Pattern used to replace `../../../../../` references.
    `static String` | `DOCROOT_PATTERN2` | Pattern used to replace `../../../../../` references.
    `static Pattern` | `NAME_ARGS_REGEX` | Pattern used to split a method reference into its name and argument list.
    `static Pattern` | `REF_LABEL_REGEX` | Pattern used to split a reference target from its optional label.
    `static Pattern` | `SPLIT_ARGS_REGEX` | Pattern used to split comma-separated method argument declarations.

  - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class SimpleGroovyDoc` | `ANNOTATION_DEF, CLASS_DEF, ENUM_DEF, INTERFACE_DEF, RECORD_DEF, TRAIT_DEF`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `SimpleGroovyClassDoc(List<String> importedClassesAndPackages, Map<String, String> aliases, String name, List<LinkArgument> links)` Creates a documented class with explicit imports, aliases, and external links.
    `SimpleGroovyClassDoc(List<String> importedClassesAndPackages, Map<String, String> aliases, String name)` Creates a documented class with explicit imports and aliases.
    `SimpleGroovyClassDoc(List<String> importedClassesAndPackages, String name)` Creates a documented class with explicit imports and no aliases.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public boolean` | `add(GroovyConstructorDoc constructor)` Adds a constructor to this class.
    `` | `public boolean` | `add(GroovyFieldDoc field)` Adds a field to this class.
    `` | `public boolean` | `add(GroovyMethodDoc method)` Adds a method to this class.
    `` | `public boolean` | `addEnumConstant(GroovyFieldDoc field)` Adds an enum constant to this class.
    `` | `public void` | `addInterfaceName(String className)` Adds the name of an implemented or extended interface for later resolution.
    `` | `public boolean` | `addNested(GroovyClassDoc nestedClass)` Adds a nested class or interface to this class.
    `` | `public boolean` | `addProperty(GroovyFieldDoc property)` Adds a property to this class.
    `` | `public String` | `commentText()` * Returns the processed comment text for this element. * * Returns: the rendered comment text
    `` | `public GroovyConstructorDoc[]` | `constructors()` returns a sorted array of constructors
    `` | `public GroovyConstructorDoc[]` | `constructors(boolean filter)` * Returns the constructors declared by this type, optionally applying the active visibility filter. * * Parameters: `filter` - `true` to include only visible constructors, `false` to include all constructors * Returns: the matching constructors
    `` | `public boolean` | `definesSerializableFields()` * Indicates whether this type explicitly defines serializable fields metadata. * * Returns: `true` if serializable fields are defined explicitly
    `` | `public static String` | `encodeAngleBrackets(String text)` Escapes angle brackets in plain text so they remain visible in rendered HTML.
    `` | `public static String` | `encodeAngleBracketsInTagBody(String text, Pattern regex)` Replaces angle brackets inside a tag.
    `` | `public GroovyFieldDoc[]` | `enumConstants()` returns a sorted array of enum constants
    `` | `public GroovyFieldDoc[]` | `fields()` returns a sorted array of fields
    `` | `public GroovyFieldDoc[]` | `fields(boolean filter)` * Returns the fields declared by this type, optionally applying the active visibility filter. * * Parameters: `filter` - `true` to include only visible fields, `false` to include all fields * Returns: the matching fields
    `` | `public GroovyClassDoc` | `findClass(String className)` * Resolves a referenced class name from the context of this type. * * Parameters: `className` - the class name to resolve * Returns: the matching class documentation, or `null` if it cannot be resolved
    `` | `public String` | `firstSentenceCommentText()` * Returns the first sentence of the processed comment text. * * Returns: the first sentence summary
    `` | `public String` | `getDocUrl(String type)` Builds a documentation URL for the supplied type using the current rendering context.
    `` | `public String` | `getDocUrl(String type, boolean full)` Builds a documentation URL for the supplied type using the current rendering context.
    `` | `public static String` | `getDocUrl(String type, boolean full, List<LinkArgument> links, String relativePath, GroovyRootDoc rootDoc, SimpleGroovyClassDoc classDoc)` Builds a documentation URL for the supplied type using explicit rendering context inputs.
    `` | `public String` | `getFullPathName()`
    `` | `public String` | `getNameWithTypeArgs()` Returns the rendered class name including any type arguments.
    `` | `public GroovyClassDoc` | `getOuter()` Returns the enclosing class when this class is nested.
    `` | `public List<GroovyClassDoc>` | `getParentClasses()` Returns this class together with its resolved superclass chain.
    `` | `public Set<GroovyClassDoc>` | `getParentInterfaces()` Returns this class and all interfaces reachable from its direct interfaces.
    `` | `public String` | `getRelativeRootPath()`
    `` | `public String` | `getSuperClassName()` Returns the unresolved superclass name parsed from source.
    `` | `public GroovyClassDoc[]` | `importedClasses()` * Returns the explicitly imported classes visible to this type. * * Returns: the imported classes
    `` | `public GroovyPackageDoc[]` | `importedPackages()` * Returns the imported packages visible to this type. * * Returns: the imported packages
    `` | `public GroovyClassDoc[]` | `innerClasses()` returns a sorted array of nested classes and interfaces
    `` | `public GroovyClassDoc[]` | `innerClasses(boolean filter)` * Returns the nested classes declared by this type, optionally applying the active visibility filter. * * Parameters: `filter` - `true` to include only visible nested classes, `false` to include all nested classes * Returns: the matching nested classes
    `` | `public GroovyType[]` | `interfaceTypes()` * Returns the interface types directly implemented or extended by this type. * * Returns: the direct interface types
    `` | `public GroovyClassDoc[]` | `interfaces()` * Returns the interfaces directly implemented or extended by this type. * * Returns: the direct interfaces
    `` | `public boolean` | `isExternalizable()` * Indicates whether this type implements Externalizable. * * Returns: `true` if this type is externalizable
    `` | `public boolean` | `isGroovy()` Indicates whether this class originated from Groovy source.
    `` | `public boolean` | `isPrimitive()` * Indicates whether this type is a Java primitive type. * * Returns: `true` if this type is primitive
    `` | `public boolean` | `isSerializable()` * Indicates whether this type implements Serializable. * * Returns: `true` if this type is serializable
    `` | `public GroovyMethodDoc[]` | `methods()` returns a sorted array of methods
    `` | `public GroovyMethodDoc[]` | `methods(boolean filter)` * Returns the methods declared by this type, optionally applying the active visibility filter. * * Parameters: `filter` - `true` to include only visible methods, `false` to include all methods * Returns: the matching methods
    `` | `public GroovyFieldDoc[]` | `properties()` returns a sorted array of properties
    `` | `public String` | `qualifiedTypeName()` * The qualified name of this type excluding any dimension information. * For example, a two-dimensional array of String returns "`java.lang.String`".
    `` | `public String` | `replaceTags(String comment)` Replaces inline tags in the supplied comment using this class as the rendering context.
    `` | `public String` | `replaceTags(String comment, GroovyMemberDoc memberDoc)` GROOVY-3782 / GROOVY-6016: overload that threads the current member through to TagRenderer so inline tags that need the enclosing member context (e.g.
    `` | `public GroovyFieldDoc[]` | `serializableFields()` * Returns the fields that participate in serialization. * * Returns: the serializable fields
    `` | `public GroovyMethodDoc[]` | `serializationMethods()` * Returns the methods related to custom serialization. * * Returns: the serialization methods
    `` | `public void` | `setFullPathName(String fullPathName)` Sets the output path used for this class in generated documentation.
    `` | `public void` | `setGroovy(boolean isgroovy)` Sets whether this class originated from Groovy source.
    `` | `public void` | `setNameWithTypeArgs(String nameWithTypeArgs)` Stores the rendered class name including any type arguments.
    `` | `public void` | `setOuter(GroovyClassDoc outer)` Sets the enclosing class for this nested class.
    `` | `public void` | `setSuperClass(GroovyClassDoc doc)` Sets the resolved superclass for this class.
    `` | `public void` | `setSuperClassName(String className)` Stores the unresolved superclass name parsed from source.
    `` | `public String` | `simpleTypeName()` * The unqualified name of this type excluding any dimension or nesting information. * For example, the class `Outer.Inner` returns "`Inner`".
    `` | `public boolean` | `subclassOf(GroovyClassDoc gcd)` * Determines whether this type is a subclass of the supplied candidate. * * Parameters: `gcd` - the candidate superclass * Returns: `true` if this type is a subclass of `gcd`
    `` | `public GroovyClassDoc` | `superclass()` * Returns the direct superclass of this type. * * Returns: the direct superclass, or `null` if none exists
    `` | `public GroovyType` | `superclassType()` * Returns the direct superclass as a type reference. * * Returns: the direct superclass type, or `null` if none exists
    `` | `public String` | `typeName()` * The unqualified name of this type excluding any dimension information. * For example, a two-dimensional array of String returns "`String`".

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class SimpleGroovyAbstractableElementDoc` | `isAbstract, setAbstract`
    `class SimpleGroovyProgramElementDoc` | `addAnnotationRef, annotations, containingClass, containingPackage, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, modifierSpecifier, modifiers, qualifiedName, setContainingPackage, setFinal, setPackagePrivate, setPrivate, setProtected, setPublic, setStatic`
    `class SimpleGroovyDoc` | `calculateFirstSentence, commentText, compareTo, firstSentenceCommentText, getRawCommentText, getTypeDescription, getTypeSourceDescription, isAnnotationType, isAnnotationTypeElement, isClass, isConstructor, isDeprecated, isEnum, isEnumConstant, isError, isException, isField, isHidden, isIncluded, isInterface, isMarkdown, isMethod, isOrdinaryClass, isRecord, isScript, isTrait, name, setCommentText, setDeprecated, setFirstSentenceCommentText, setHidden, setMarkdown, setRawCommentText, setScript, setTokenType, tags, toString, tokenType`

- - ### Field Detail

    - #### public static final Pattern CODE_REGEX

      Pattern used to locate `{@code ...`} style inline tags for angle-bracket escaping.

    - #### public static final String DOCROOT_PATTERN

      Pattern used to replace `../../../../../` references.

    - #### public static final String DOCROOT_PATTERN2

      Pattern used to replace `../../../../../` references.

    - #### public static final Pattern NAME_ARGS_REGEX

      Pattern used to split a method reference into its name and argument list.

    - #### public static final Pattern REF_LABEL_REGEX

      Pattern used to split a reference target from its optional label.

    - #### public static final Pattern SPLIT_ARGS_REGEX

      Pattern used to split comma-separated method argument declarations.

  - ### Constructor Detail

    - #### public SimpleGroovyClassDoc(List<String> importedClassesAndPackages, Map<String, String> aliases, String name, List<LinkArgument> links)

      Creates a documented class with explicit imports, aliases, and external links.

      Parameters:
        `importedClassesAndPackages` - the imports visible to the class
        `aliases` - the import aliases visible to the class
        `name` - the simple class name
        `links` - the configured external documentation links

    - #### public SimpleGroovyClassDoc(List<String> importedClassesAndPackages, Map<String, String> aliases, String name)

      Creates a documented class with explicit imports and aliases.

      Parameters:
        `importedClassesAndPackages` - the imports visible to the class
        `aliases` - the import aliases visible to the class
        `name` - the simple class name

    - #### public SimpleGroovyClassDoc(List<String> importedClassesAndPackages, String name)

      Creates a documented class with explicit imports and no aliases.

      Parameters:
        `importedClassesAndPackages` - the imports visible to the class
        `name` - the simple class name

  - ### Method Detail

    - #### public boolean add(GroovyConstructorDoc constructor)

      Adds a constructor to this class.

      Parameters:
        `constructor` - the constructor to add
      Returns:
        `true` if the constructor was added

    - #### public boolean add(GroovyFieldDoc field)

      Adds a field to this class.

      Parameters:
        `field` - the field to add
      Returns:
        `true` if the field was added

    - #### public boolean add(GroovyMethodDoc method)

      Adds a method to this class.

      Parameters:
        `method` - the method to add
      Returns:
        `true` if the method was added

    - #### public boolean addEnumConstant(GroovyFieldDoc field)

      Adds an enum constant to this class.

      Parameters:
        `field` - the enum constant to add
      Returns:
        `true` if the enum constant was added

    - #### public void addInterfaceName(String className)

      Adds the name of an implemented or extended interface for later resolution.

      Parameters:
        `className` - the interface name to add

    - #### public boolean addNested(GroovyClassDoc nestedClass)

      Adds a nested class or interface to this class.

      Parameters:
        `nestedClass` - the nested class to add
      Returns:
        `true` if the nested class was added

    - #### public boolean addProperty(GroovyFieldDoc property)

      Adds a property to this class.

      Parameters:
        `property` - the property to add
      Returns:
        `true` if the property was added

    - #### public String commentText()

      * Returns the processed comment text for this element. * *

      Returns:
        the rendered comment text

    - #### public GroovyConstructorDoc[] constructors()

      returns a sorted array of constructors

    - #### public GroovyConstructorDoc[] constructors(boolean filter)

      * Returns the constructors declared by this type, optionally applying the active visibility filter. * *

      Parameters:
        `filter` - `true` to include only visible constructors, `false` to include all constructors *
      Returns:
        the matching constructors

    - #### public boolean definesSerializableFields()

      * Indicates whether this type explicitly defines serializable fields metadata. * *

      Returns:
        `true` if serializable fields are defined explicitly

    - #### public static String encodeAngleBrackets(String text)

      Escapes angle brackets in plain text so they remain visible in rendered HTML.

      Parameters:
        `text` - the text to escape
      Returns:
        the escaped text

    - #### public static String encodeAngleBracketsInTagBody(String text, Pattern regex)

      Replaces angle brackets inside a tag.

      Parameters:
        `text` - GroovyDoc text to process
        `regex` - has to capture tag name in group 1 and tag body in group 2

    - #### public GroovyFieldDoc[] enumConstants()

      returns a sorted array of enum constants

    - #### public GroovyFieldDoc[] fields()

      returns a sorted array of fields

    - #### public GroovyFieldDoc[] fields(boolean filter)

      * Returns the fields declared by this type, optionally applying the active visibility filter. * *

      Parameters:
        `filter` - `true` to include only visible fields, `false` to include all fields *
      Returns:
        the matching fields

    - #### public GroovyClassDoc findClass(String className)

      * Resolves a referenced class name from the context of this type. * *

      Parameters:
        `className` - the class name to resolve *
      Returns:
        the matching class documentation, or `null` if it cannot be resolved

    - #### public String firstSentenceCommentText()

      * Returns the first sentence of the processed comment text. * *

      Returns:
        the first sentence summary

    - #### public String getDocUrl(String type)

      Builds a documentation URL for the supplied type using the current rendering context.

      Parameters:
        `type` - the type or reference to render
      Returns:
        the rendered documentation URL or original text

    - #### public String getDocUrl(String type, boolean full)

      Builds a documentation URL for the supplied type using the current rendering context.

      Parameters:
        `type` - the type or reference to render
        `full` - `true` to prefer fully qualified labels
      Returns:
        the rendered documentation URL or original text

    - #### public static String getDocUrl(String type, boolean full, List<LinkArgument> links, String relativePath, GroovyRootDoc rootDoc, SimpleGroovyClassDoc classDoc)

      Builds a documentation URL for the supplied type using explicit rendering context inputs.

      Parameters:
        `type` - the type or reference to render
        `full` - `true` to prefer fully qualified labels
        `links` - the configured external documentation links
        `relativePath` - the relative path back to the documentation root
        `rootDoc` - the root document used for in-project lookups
        `classDoc` - the current class context
      Returns:
        the rendered documentation URL or original text

    - #### public String getFullPathName()

    - #### public String getNameWithTypeArgs()

      Returns the rendered class name including any type arguments.

      Returns:
        the class name with type arguments, or `null` if none was recorded

    - #### public GroovyClassDoc getOuter()

      Returns the enclosing class when this class is nested.

      Returns:
        the enclosing class, or `null` if this class is top-level

    - #### public List<GroovyClassDoc> getParentClasses()

      Returns this class together with its resolved superclass chain.

      Returns:
        the superclass chain ordered from the root type to this class

    - #### public Set<GroovyClassDoc> getParentInterfaces()

      Returns this class and all interfaces reachable from its direct interfaces.

      Returns:
        the transitive interface closure for this class

    - #### public String getRelativeRootPath()

    - #### public String getSuperClassName()

      Returns the unresolved superclass name parsed from source.

      Returns:
        the unresolved superclass name, or `null` if none was declared

    - #### public GroovyClassDoc[] importedClasses()

      * Returns the explicitly imported classes visible to this type. * *

      Returns:
        the imported classes

    - #### public GroovyPackageDoc[] importedPackages()

      * Returns the imported packages visible to this type. * *

      Returns:
        the imported packages

    - #### public GroovyClassDoc[] innerClasses()

      returns a sorted array of nested classes and interfaces

    - #### public GroovyClassDoc[] innerClasses(boolean filter)

      * Returns the nested classes declared by this type, optionally applying the active visibility filter. * *

      Parameters:
        `filter` - `true` to include only visible nested classes, `false` to include all nested classes *
      Returns:
        the matching nested classes

    - #### public GroovyType[] interfaceTypes()

      * Returns the interface types directly implemented or extended by this type. * *

      Returns:
        the direct interface types

    - #### public GroovyClassDoc[] interfaces()

      * Returns the interfaces directly implemented or extended by this type. * *

      Returns:
        the direct interfaces

    - #### public boolean isExternalizable()

      * Indicates whether this type implements Externalizable. * *

      Returns:
        `true` if this type is externalizable

    - #### public boolean isGroovy()

      Indicates whether this class originated from Groovy source.

      Returns:
        `true` if this class came from Groovy source

    - #### public boolean isPrimitive()

      * Indicates whether this type is a Java primitive type. * *

      Returns:
        `true` if this type is primitive

    - #### public boolean isSerializable()

      * Indicates whether this type implements Serializable. * *

      Returns:
        `true` if this type is serializable

    - #### public GroovyMethodDoc[] methods()

      returns a sorted array of methods

    - #### public GroovyMethodDoc[] methods(boolean filter)

      * Returns the methods declared by this type, optionally applying the active visibility filter. * *

      Parameters:
        `filter` - `true` to include only visible methods, `false` to include all methods *
      Returns:
        the matching methods

    - #### public GroovyFieldDoc[] properties()

      returns a sorted array of properties

    - #### public String qualifiedTypeName()

      * The qualified name of this type excluding any dimension information. * For example, a two-dimensional array of String returns "`java.lang.String`".

    - #### public String replaceTags(String comment)

      Replaces inline tags in the supplied comment using this class as the rendering context.

      Parameters:
        `comment` - the comment to process
      Returns:
        the processed comment text

    - #### public String replaceTags(String comment, GroovyMemberDoc memberDoc)

      GROOVY-3782 / GROOVY-6016: overload that threads the current member through to TagRenderer so inline tags that need the enclosing member context (e.g. `{@inheritDoc`} needs the current method to find its overridden parent) can resolve.

      Since:
        6.0.0

    - #### public GroovyFieldDoc[] serializableFields()

      * Returns the fields that participate in serialization. * *

      Returns:
        the serializable fields

    - #### public GroovyMethodDoc[] serializationMethods()

      * Returns the methods related to custom serialization. * *

      Returns:
        the serialization methods

    - #### public void setFullPathName(String fullPathName)

      Sets the output path used for this class in generated documentation.

      Parameters:
        `fullPathName` - the documentation path for this class

    - #### public void setGroovy(boolean isgroovy)

      Sets whether this class originated from Groovy source.

      Parameters:
        `isgroovy` - `true` if this class came from Groovy source

    - #### public void setNameWithTypeArgs(String nameWithTypeArgs)

      Stores the rendered class name including any type arguments.

      Parameters:
        `nameWithTypeArgs` - the rendered class name with type arguments

    - #### public void setOuter(GroovyClassDoc outer)

      Sets the enclosing class for this nested class.

      Parameters:
        `outer` - the enclosing class

    - #### public void setSuperClass(GroovyClassDoc doc)

      Sets the resolved superclass for this class.

      Parameters:
        `doc` - the resolved superclass

    - #### public void setSuperClassName(String className)

      Stores the unresolved superclass name parsed from source.

      Parameters:
        `className` - the unresolved superclass name

    - #### public String simpleTypeName()

      * The unqualified name of this type excluding any dimension or nesting information. * For example, the class `Outer.Inner` returns "`Inner`".

    - #### public boolean subclassOf(GroovyClassDoc gcd)

      * Determines whether this type is a subclass of the supplied candidate. * *

      Parameters:
        `gcd` - the candidate superclass *
      Returns:
        `true` if this type is a subclass of `gcd`

    - #### public GroovyClassDoc superclass()

      * Returns the direct superclass of this type. * *

      Returns:
        the direct superclass, or `null` if none exists

    - #### public GroovyType superclassType()

      * Returns the direct superclass as a type reference. * *

      Returns:
        the direct superclass type, or `null` if none exists

    - #### public String typeName()

      * The unqualified name of this type excluding any dimension information. * For example, a two-dimensional array of String returns "`String`".