Record Class RightCurlyCheck.Details
java.lang.Object
java.lang.Record
com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.Details
- Record Components:
lcurly- the left curly token being analysedrcurly- the matching right curly tokennextToken- the token following the right curlyshouldCheckLastRcurly- flag that indicates if the last right curly should be checked
- Enclosing class:
- RightCurlyCheck
private static record RightCurlyCheck.Details(DetailAST lcurly, DetailAST rcurly, DetailAST nextToken, boolean shouldCheckLastRcurly)
extends Record
Structure that contains all details for validation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DetailASTThe field for thelcurlyrecord component.private final DetailASTThe field for thenextTokenrecord component.private final DetailASTThe field for thercurlyrecord component.private final booleanThe field for theshouldCheckLastRcurlyrecord component.private static final int[]Token types that identify tokens that will never have SLIST in their AST. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.private static RightCurlyCheck.DetailsgetDetails(DetailAST ast) Collects validation Details.private static RightCurlyCheck.DetailsgetDetailsForCase(DetailAST caseNode) Collects details about case statements.private static RightCurlyCheck.DetailsCollects validation details for LITERAL_DO loops' tokens.private static RightCurlyCheck.DetailsgetDetailsForIf(DetailAST ast) Collects validation details for LITERAL_IF.private static RightCurlyCheck.DetailsCollects validation details for CLASS_DEF, RECORD_DEF, METHOD DEF, CTOR_DEF, STATIC_INIT, INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF, and COMPACT_CTOR_DEF.private static RightCurlyCheck.DetailsgetDetailsForSwitch(DetailAST switchNode) Collects details about switch statements and expressions.private static RightCurlyCheck.DetailsCollects validation details for LITERAL_TRY, and LITERAL_CATCH.private static DetailASTgetNextToken(DetailAST ast) Finds next token after the given one.final inthashCode()Returns a hash code value for this object.private static booleanisSwitchExpression(DetailAST switchNode) Check whether switch is expression or not.private static booleanisTokenWithNoChildSlist(int tokenType) Tests whether the provided tokenType will never have a SLIST as child in its AST.lcurly()Returns the value of thelcurlyrecord component.Returns the value of thenextTokenrecord component.rcurly()Returns the value of thercurlyrecord component.booleanReturns the value of theshouldCheckLastRcurlyrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
lcurly
The field for thelcurlyrecord component. -
rcurly
The field for thercurlyrecord component. -
nextToken
The field for thenextTokenrecord component. -
shouldCheckLastRcurly
The field for theshouldCheckLastRcurlyrecord component. -
TOKENS_WITH_NO_CHILD_SLIST
Token types that identify tokens that will never have SLIST in their AST.
-
-
Constructor Details
-
Details
private Details(DetailAST lcurly, DetailAST rcurly, DetailAST nextToken, boolean shouldCheckLastRcurly) Creates an instance of aDetailsrecord class.- Parameters:
lcurly- the value for thelcurlyrecord componentrcurly- the value for thercurlyrecord componentnextToken- the value for thenextTokenrecord componentshouldCheckLastRcurly- the value for theshouldCheckLastRcurlyrecord component
-
-
Method Details
-
getDetails
Collects validation Details.- Parameters:
ast- aDetailASTvalue- Returns:
- object containing all details to make a validation
-
getDetailsForSwitch
Collects details about switch statements and expressions.- Parameters:
switchNode- switch statement or expression to gather details about- Returns:
- new Details about given switch statement or expression
-
getDetailsForCase
Collects details about case statements.- Parameters:
caseNode- case statement to gather details about- Returns:
- new Details about given case statement
-
isSwitchExpression
Check whether switch is expression or not.- Parameters:
switchNode- switch statement or expression to provide detail- Returns:
- true if it is a switch expression
-
getDetailsForTryCatch
Collects validation details for LITERAL_TRY, and LITERAL_CATCH.- Parameters:
ast- aDetailASTvalue- Returns:
- object containing all details to make a validation
-
getDetailsForIf
Collects validation details for LITERAL_IF.- Parameters:
ast- aDetailASTvalue- Returns:
- object containing all details to make a validation
-
getDetailsForOthers
Collects validation details for CLASS_DEF, RECORD_DEF, METHOD DEF, CTOR_DEF, STATIC_INIT, INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF, and COMPACT_CTOR_DEF.- Parameters:
ast- aDetailASTvalue- Returns:
- an object containing all details to make a validation
-
isTokenWithNoChildSlist
Tests whether the provided tokenType will never have a SLIST as child in its AST. Like CLASS_DEF, ANNOTATION_DEF etc.- Parameters:
tokenType- the tokenType to test against.- Returns:
- weather provided tokenType is definition token.
-
getDetailsForDoLoops
Collects validation details for LITERAL_DO loops' tokens.- Parameters:
ast- aDetailASTvalue- Returns:
- an object containing all details to make a validation
-
getNextToken
Finds next token after the given one.- Parameters:
ast- the given node.- Returns:
- the token which represents next lexical item.
-
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 '=='. -
lcurly
Returns the value of thelcurlyrecord component.- Returns:
- the value of the
lcurlyrecord component
-
rcurly
Returns the value of thercurlyrecord component.- Returns:
- the value of the
rcurlyrecord component
-
nextToken
Returns the value of thenextTokenrecord component.- Returns:
- the value of the
nextTokenrecord component
-
shouldCheckLastRcurly
Returns the value of theshouldCheckLastRcurlyrecord component.- Returns:
- the value of the
shouldCheckLastRcurlyrecord component
-