Class SimpleGroovyClassDoc

All Implemented Interfaces:
Comparable<GroovyDoc>, GroovyClassDoc, GroovyDoc, GroovyProgramElementDoc, GroovyType

public class SimpleGroovyClassDoc extends SimpleGroovyAbstractableElementDoc implements GroovyClassDoc
Default GroovyClassDoc implementation for classes parsed from Groovy or Java source.
  • Field Details

    • DOCROOT_PATTERN2

      public static final String DOCROOT_PATTERN2
      Pattern used to replace {@docRoot}/ references.
      See Also:
    • DOCROOT_PATTERN

      public static final String DOCROOT_PATTERN
      Pattern used to replace {@docRoot} references.
      See Also:
    • CODE_REGEX

      public static final Pattern CODE_REGEX
      Pattern used to locate {@code ...} style inline tags for angle-bracket escaping.
    • REF_LABEL_REGEX

      public static final Pattern REF_LABEL_REGEX
      Pattern used to split a reference target from its optional label.
    • NAME_ARGS_REGEX

      public static final Pattern NAME_ARGS_REGEX
      Pattern used to split a method reference into its name and argument list.
    • SPLIT_ARGS_REGEX

      public static final Pattern SPLIT_ARGS_REGEX
      Pattern used to split comma-separated method argument declarations.
  • Constructor Details

    • SimpleGroovyClassDoc

      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
    • SimpleGroovyClassDoc

      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
    • SimpleGroovyClassDoc

      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 Details

    • constructors

      public GroovyConstructorDoc[] constructors()
      returns a sorted array of constructors
      Specified by:
      constructors in interface GroovyClassDoc
      Returns:
      the declared constructors
    • add

      public boolean add(GroovyConstructorDoc constructor)
      Adds a constructor to this class.
      Parameters:
      constructor - the constructor to add
      Returns:
      true if the constructor was added
    • getOuter

      public GroovyClassDoc getOuter()
      Returns the enclosing class when this class is nested.
      Returns:
      the enclosing class, or null if this class is top-level
    • setOuter

      public void setOuter(GroovyClassDoc outer)
      Sets the enclosing class for this nested class.
      Parameters:
      outer - the enclosing class
    • isGroovy

      public boolean isGroovy()
      Indicates whether this class originated from Groovy source.
      Returns:
      true if this class came from Groovy source
    • setGroovy

      public void setGroovy(boolean isgroovy)
      Sets whether this class originated from Groovy source.
      Parameters:
      isgroovy - true if this class came from Groovy source
    • innerClasses

      public GroovyClassDoc[] innerClasses()
      returns a sorted array of nested classes and interfaces
      Specified by:
      innerClasses in interface GroovyClassDoc
      Returns:
      the nested classes
    • addNested

      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
    • fields

      public GroovyFieldDoc[] fields()
      returns a sorted array of fields
      Specified by:
      fields in interface GroovyClassDoc
      Returns:
      the declared fields
    • add

      public boolean add(GroovyFieldDoc field)
      Adds a field to this class.
      Parameters:
      field - the field to add
      Returns:
      true if the field was added
    • properties

      public GroovyFieldDoc[] properties()
      returns a sorted array of properties
      Specified by:
      properties in interface GroovyClassDoc
      Returns:
      the declared properties
    • addProperty

      public boolean addProperty(GroovyFieldDoc property)
      Adds a property to this class.
      Parameters:
      property - the property to add
      Returns:
      true if the property was added
    • enumConstants

      public GroovyFieldDoc[] enumConstants()
      returns a sorted array of enum constants
      Specified by:
      enumConstants in interface GroovyClassDoc
      Returns:
      the declared enum constants
    • addEnumConstant

      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
    • methods

      public GroovyMethodDoc[] methods()
      returns a sorted array of methods
      Specified by:
      methods in interface GroovyClassDoc
      Returns:
      the declared methods
    • add

      public boolean add(GroovyMethodDoc method)
      Adds a method to this class.
      Parameters:
      method - the method to add
      Returns:
      true if the method was added
    • getSuperClassName

      public String getSuperClassName()
      Returns the unresolved superclass name parsed from source.
      Returns:
      the unresolved superclass name, or null if none was declared
    • setSuperClassName

      public void setSuperClassName(String className)
      Stores the unresolved superclass name parsed from source.
      Parameters:
      className - the unresolved superclass name
    • superclass

      public GroovyClassDoc superclass()
      Returns the direct superclass of this type.
      Specified by:
      superclass in interface GroovyClassDoc
      Returns:
      the direct superclass, or null if none exists
    • setSuperClass

      public void setSuperClass(GroovyClassDoc doc)
      Sets the resolved superclass for this class.
      Parameters:
      doc - the resolved superclass
    • getFullPathName

      public String getFullPathName()
      Returns the documentation output path for this type.
      Specified by:
      getFullPathName in interface GroovyClassDoc
      Returns:
      the full path used when rendering this type
    • setFullPathName

      public void setFullPathName(String fullPathName)
      Sets the output path used for this class in generated documentation.
      Parameters:
      fullPathName - the documentation path for this class
    • getRelativeRootPath

      public String getRelativeRootPath()
      Returns the relative path from this type to the documentation root.
      Specified by:
      getRelativeRootPath in interface GroovyClassDoc
      Returns:
      the relative path to the documentation root
    • getParentClasses

      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
    • getParentInterfaces

      public Set<GroovyClassDoc> getParentInterfaces()
      Returns this class and all interfaces reachable from its direct interfaces.
      Returns:
      the transitive interface closure for this class
    • getDocUrl

      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
    • getDocUrl

      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
    • getDocUrl

      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
    • constructors

      public GroovyConstructorDoc[] constructors(boolean filter)
      Returns the constructors declared by this type, optionally applying the active visibility filter.
      Specified by:
      constructors in interface GroovyClassDoc
      Parameters:
      filter - true to include only visible constructors, false to include all constructors
      Returns:
      the matching constructors
    • definesSerializableFields

      public boolean definesSerializableFields()
      Indicates whether this type explicitly defines serializable fields metadata.
      Specified by:
      definesSerializableFields in interface GroovyClassDoc
      Returns:
      true if serializable fields are defined explicitly
    • fields

      public GroovyFieldDoc[] fields(boolean filter)
      Returns the fields declared by this type, optionally applying the active visibility filter.
      Specified by:
      fields in interface GroovyClassDoc
      Parameters:
      filter - true to include only visible fields, false to include all fields
      Returns:
      the matching fields
    • findClass

      public GroovyClassDoc findClass(String className)
      Resolves a referenced class name from the context of this type.
      Specified by:
      findClass in interface GroovyClassDoc
      Parameters:
      className - the class name to resolve
      Returns:
      the matching class documentation, or null if it cannot be resolved
    • importedClasses

      public GroovyClassDoc[] importedClasses()
      Returns the explicitly imported classes visible to this type.
      Specified by:
      importedClasses in interface GroovyClassDoc
      Returns:
      the imported classes
    • importedPackages

      public GroovyPackageDoc[] importedPackages()
      Returns the imported packages visible to this type.
      Specified by:
      importedPackages in interface GroovyClassDoc
      Returns:
      the imported packages
    • innerClasses

      public GroovyClassDoc[] innerClasses(boolean filter)
      Returns the nested classes declared by this type, optionally applying the active visibility filter.
      Specified by:
      innerClasses in interface GroovyClassDoc
      Parameters:
      filter - true to include only visible nested classes, false to include all nested classes
      Returns:
      the matching nested classes
    • interfaces

      public GroovyClassDoc[] interfaces()
      Returns the interfaces directly implemented or extended by this type.
      Specified by:
      interfaces in interface GroovyClassDoc
      Returns:
      the direct interfaces
    • interfaceTypes

      public GroovyType[] interfaceTypes()
      Returns the interface types directly implemented or extended by this type.
      Specified by:
      interfaceTypes in interface GroovyClassDoc
      Returns:
      the direct interface types
    • isExternalizable

      public boolean isExternalizable()
      Indicates whether this type implements Externalizable.
      Specified by:
      isExternalizable in interface GroovyClassDoc
      Returns:
      true if this type is externalizable
    • isSerializable

      public boolean isSerializable()
      Indicates whether this type implements Serializable.
      Specified by:
      isSerializable in interface GroovyClassDoc
      Returns:
      true if this type is serializable
    • methods

      public GroovyMethodDoc[] methods(boolean filter)
      Returns the methods declared by this type, optionally applying the active visibility filter.
      Specified by:
      methods in interface GroovyClassDoc
      Parameters:
      filter - true to include only visible methods, false to include all methods
      Returns:
      the matching methods
    • serializableFields

      public GroovyFieldDoc[] serializableFields()
      Returns the fields that participate in serialization.
      Specified by:
      serializableFields in interface GroovyClassDoc
      Returns:
      the serializable fields
    • serializationMethods

      public GroovyMethodDoc[] serializationMethods()
      Returns the methods related to custom serialization.
      Specified by:
      serializationMethods in interface GroovyClassDoc
      Returns:
      the serialization methods
    • subclassOf

      public boolean subclassOf(GroovyClassDoc gcd)
      Determines whether this type is a subclass of the supplied candidate.
      Specified by:
      subclassOf in interface GroovyClassDoc
      Parameters:
      gcd - the candidate superclass
      Returns:
      true if this type is a subclass of gcd
    • superclassType

      public GroovyType superclassType()
      Returns the direct superclass as a type reference.
      Specified by:
      superclassType in interface GroovyClassDoc
      Returns:
      the direct superclass type, or null if none exists
    • isPrimitive

      public boolean isPrimitive()
      Indicates whether this type is a Java primitive type.
      Specified by:
      isPrimitive in interface GroovyType
      Returns:
      true if this type is primitive
    • qualifiedTypeName

      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".
      Specified by:
      qualifiedTypeName in interface GroovyType
    • simpleTypeName

      public String simpleTypeName()
      The unqualified name of this type excluding any dimension or nesting information. For example, the class Outer.Inner returns "Inner".
      Specified by:
      simpleTypeName in interface GroovyType
    • typeName

      public String typeName()
      The unqualified name of this type excluding any dimension information. For example, a two-dimensional array of String returns "String".
      Specified by:
      typeName in interface GroovyType
    • addInterfaceName

      public void addInterfaceName(String className)
      Adds the name of an implemented or extended interface for later resolution.
      Parameters:
      className - the interface name to add
    • firstSentenceCommentText

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

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

      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
    • replaceTags

      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
    • encodeAngleBracketsInTagBody

      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
    • encodeAngleBrackets

      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
    • setNameWithTypeArgs

      public void setNameWithTypeArgs(String nameWithTypeArgs)
      Stores the rendered class name including any type arguments.
      Parameters:
      nameWithTypeArgs - the rendered class name with type arguments
    • getNameWithTypeArgs

      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