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 orderingkind- whether the reference is a field, constructor, or methodqualifier- owning type name, or an empty string for local and non-member referencesname- simple member or type name used for groupingparameterCount- number of parameters, used to order overloaded methodstext- 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 Summary
FieldsModifier and TypeFieldDescriptionprivate final JavadocSeeTagOrderCheck.CategoryThe field for thecategoryrecord component.private final JavadocSeeTagOrderCheck.KindThe field for thekindrecord component.private final StringThe field for thenamerecord component.private final intThe field for theparameterCountrecord component.private final StringThe field for thequalifierrecord component.private final StringThe field for thetextrecord component. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateSeeReference(JavadocSeeTagOrderCheck.Category category, JavadocSeeTagOrderCheck.Kind kind, String qualifier, String name, int parameterCount, String text) Creates an instance of aSeeReferencerecord class. -
Method Summary
Modifier and TypeMethodDescriptioncategory()Returns the value of thecategoryrecord component.final booleanIndicates whether some other object is "equal to" this one.private static JavadocSeeTagOrderCheck.SeeReferencefrom(DetailNode seeBlock, String enclosingTypeName) Parses a@seeblock tag into aSeeReference, or returnsnullif the reference is not in a form that can be confidently ordered.final inthashCode()Returns a hash code value for this object.private static booleanisFragmentReference(DetailNode reference) Checks whether the given reference uses theType##fragmentsyntax to link to a named fragment within a page, recognizable by two consecutive hash signs among its children.private static booleanisPackageReference(String referenceText) Checks whether the given text looks like a package reference (all lowercase segments and contains at least one dot).private static booleanisTypeReference(String referenceText) Checks whether the given text looks like a type reference (last segment starts with an uppercase letter).kind()Returns the value of thekindrecord component.private static StringlastIdentifier(String name) Returns the last identifier segment of a dotted name.name()Returns the value of thenamerecord component.intReturns the value of theparameterCountrecord component.parameterTypes(DetailNode member) Returns the parameter type texts of a member reference.private static JavadocSeeTagOrderCheck.SeeReferenceparseIdentifierReference(DetailNode reference, DetailNode identifierNode) Parses an identifier-based reference (simple or qualified type, member, or package reference).private static JavadocSeeTagOrderCheck.SeeReferenceparseMember(DetailNode member, String qualifier, JavadocSeeTagOrderCheck.Category category, String ownerSimpleName) Parses a member reference (local member or class member).Returns the value of thequalifierrecord component.(package private) intReturns the structural ordering key combining the category and, for member references, whether the reference is a field, constructor, or method.(package private) booleanChecks whether this reference is structurally after the given reference.text()Returns the value of thetextrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
category
The field for thecategoryrecord component. -
kind
The field for thekindrecord component. -
qualifier
The field for thequalifierrecord component. -
name
The field for thenamerecord component. -
parameterCount
The field for theparameterCountrecord component. -
text
The field for thetextrecord component.
-
-
Constructor Details
-
SeeReference
private SeeReference(JavadocSeeTagOrderCheck.Category category, JavadocSeeTagOrderCheck.Kind kind, String qualifier, String name, int parameterCount, String text) Creates an instance of aSeeReferencerecord class.- Parameters:
category- the value for thecategoryrecord componentkind- the value for thekindrecord componentqualifier- the value for thequalifierrecord componentname- the value for thenamerecord componentparameterCount- the value for theparameterCountrecord componenttext- the value for thetextrecord component
-
-
Method Details
-
from
private static JavadocSeeTagOrderCheck.SeeReference from(DetailNode seeBlock, String enclosingTypeName) Parses a@seeblock tag into aSeeReference, or returnsnullif the reference is not in a form that can be confidently ordered.- Parameters:
seeBlock- the@seeblock tagenclosingTypeName- simple name of the type that most closely encloses the Javadoc comment, used to recognize local constructor references- Returns:
- the parsed reference, or
nullif it cannot be classified
-
isFragmentReference
Checks whether the given reference uses theType##fragmentsyntax 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:
trueif the reference contains two consecutive hash signs
-
parseIdentifierReference
private static JavadocSeeTagOrderCheck.SeeReference parseIdentifierReference(DetailNode reference, DetailNode identifierNode) Parses an identifier-based reference (simple or qualified type, member, or package reference).- Parameters:
reference- the reference nodeidentifierNode- the identifier node- Returns:
- the parsed reference, or
nullif 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 nodequalifier- the owning type name, or an empty string for local memberscategory- category of the referenceownerSimpleName- simple name of the owning type, compared against the member name to recognize constructor references- Returns:
- the parsed member reference
-
parameterTypes
Returns the parameter type texts of a member reference.- Parameters:
member- the member reference node- Returns:
- the list of parameter type texts
-
isTypeReference
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:
trueif the text is a type reference
-
isPackageReference
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:
trueif the text is a package reference
-
lastIdentifier
Returns the last identifier segment of a dotted name.- Parameters:
name- the dotted name- Returns:
- the last segment
-
structuralKey
int 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:
trueif this reference is structurally after the other
-
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. -
hashCode
Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
category
Returns the value of thecategoryrecord component.- Returns:
- the value of the
categoryrecord component
-
kind
Returns the value of thekindrecord component.- Returns:
- the value of the
kindrecord component
-
qualifier
Returns the value of thequalifierrecord component.- Returns:
- the value of the
qualifierrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
parameterCount
Returns the value of theparameterCountrecord component.- Returns:
- the value of the
parameterCountrecord component
-
text
Returns the value of thetextrecord component.- Returns:
- the value of the
textrecord component
-