Record Class JavadocSeeTagOrderCheck.SeeReference

java.lang.Object
java.lang.Record
com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocSeeTagOrderCheck.SeeReference
Record Components:
category - category that defines the primary structural ordering
kind - whether the reference is a field, constructor, or method
qualifier - owning type name, or an empty string for local and non-member references
name - simple member or type name used for grouping
parameterCount - number of parameters, used to order overloaded methods
text - full reference text used for messages
Enclosing class:
JavadocSeeTagOrderCheck

private static record JavadocSeeTagOrderCheck.SeeReference(JavadocSeeTagOrderCheck.Category category, JavadocSeeTagOrderCheck.Kind kind, String qualifier, String name, int parameterCount, String text) extends Record
Represents a parsed @see reference together with the ordering information needed to validate the order.
  • Field Details

  • Constructor Details

  • Method Details

    • from

      private static JavadocSeeTagOrderCheck.SeeReference from(DetailNode seeBlock, String enclosingTypeName)
      Parses a @see block tag into a SeeReference, or returns null if the reference is not in a form that can be confidently ordered.
      Parameters:
      seeBlock - the @see block tag
      enclosingTypeName - simple name of the type that most closely encloses the Javadoc comment, used to recognize local constructor references
      Returns:
      the parsed reference, or null if it cannot be classified
    • isFragmentReference

      private static boolean isFragmentReference(DetailNode reference)
      Checks whether the given reference uses the Type##fragment syntax to link to a named fragment within a page, recognizable by two consecutive hash signs among its children. Such references are not javadoc type or member references and cannot be meaningfully compared to one.
      Parameters:
      reference - the reference node
      Returns:
      true if the reference contains two consecutive hash signs
    • parseIdentifierReference

      Parses an identifier-based reference (simple or qualified type, member, or package reference).
      Parameters:
      reference - the reference node
      identifierNode - the identifier node
      Returns:
      the parsed reference, or null if it cannot be classified
    • parseMember

      private static JavadocSeeTagOrderCheck.SeeReference parseMember(DetailNode member, String qualifier, JavadocSeeTagOrderCheck.Category category, String ownerSimpleName)
      Parses a member reference (local member or class member).
      Parameters:
      member - the member reference node
      qualifier - the owning type name, or an empty string for local members
      category - category of the reference
      ownerSimpleName - simple name of the owning type, compared against the member name to recognize constructor references
      Returns:
      the parsed member reference
    • parameterTypes

      private static List<String> parameterTypes(DetailNode member)
      Returns the parameter type texts of a member reference.
      Parameters:
      member - the member reference node
      Returns:
      the list of parameter type texts
    • isTypeReference

      private static boolean isTypeReference(String referenceText)
      Checks whether the given text looks like a type reference (last segment starts with an uppercase letter).
      Parameters:
      referenceText - the reference text to check
      Returns:
      true if the text is a type reference
    • isPackageReference

      private static boolean isPackageReference(String referenceText)
      Checks whether the given text looks like a package reference (all lowercase segments and contains at least one dot).
      Parameters:
      referenceText - the reference text to check
      Returns:
      true if the text is a package reference
    • lastIdentifier

      private static String lastIdentifier(String name)
      Returns the last identifier segment of a dotted name.
      Parameters:
      name - the dotted name
      Returns:
      the last segment
    • structuralKey

      Returns the structural ordering key combining the category and, for member references, whether the reference is a field, constructor, or method.
      Returns:
      the structural ordering key
    • structurallyAfterThan

      Checks whether this reference is structurally after the given reference.
      Parameters:
      other - the reference to compare to
      Returns:
      true if this reference is structurally after the other
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • category

      Returns the value of the category record component.
      Returns:
      the value of the category record component
    • kind

      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • qualifier

      public String qualifier()
      Returns the value of the qualifier record component.
      Returns:
      the value of the qualifier record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • parameterCount

      public int parameterCount()
      Returns the value of the parameterCount record component.
      Returns:
      the value of the parameterCount record component
    • text

      public String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component