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 analysed
rcurly - the matching right curly token
nextToken - the token following the right curly
shouldCheckLastRcurly - 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 Details

  • Constructor Details

    • Details

      private Details(DetailAST lcurly, DetailAST rcurly, DetailAST nextToken, boolean shouldCheckLastRcurly)
      Creates an instance of a Details record class.
      Parameters:
      lcurly - the value for the lcurly record component
      rcurly - the value for the rcurly record component
      nextToken - the value for the nextToken record component
      shouldCheckLastRcurly - the value for the shouldCheckLastRcurly record component
  • Method Details

    • getDetails

      Collects validation Details.
      Parameters:
      ast - a DetailAST value
      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

      private static boolean isSwitchExpression(DetailAST switchNode)
      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 - a DetailAST value
      Returns:
      object containing all details to make a validation
    • getDetailsForIf

      Collects validation details for LITERAL_IF.
      Parameters:
      ast - a DetailAST value
      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 - a DetailAST value
      Returns:
      an object containing all details to make a validation
    • isTokenWithNoChildSlist

      private static boolean isTokenWithNoChildSlist(int tokenType)
      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 - a DetailAST value
      Returns:
      an object containing all details to make a validation
    • getNextToken

      private static DetailAST getNextToken(DetailAST ast)
      Finds next token after the given one.
      Parameters:
      ast - the given node.
      Returns:
      the token which represents next lexical item.
    • 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.
    • lcurly

      public DetailAST lcurly()
      Returns the value of the lcurly record component.
      Returns:
      the value of the lcurly record component
    • rcurly

      public DetailAST rcurly()
      Returns the value of the rcurly record component.
      Returns:
      the value of the rcurly record component
    • nextToken

      public DetailAST nextToken()
      Returns the value of the nextToken record component.
      Returns:
      the value of the nextToken record component
    • shouldCheckLastRcurly

      public boolean shouldCheckLastRcurly()
      Returns the value of the shouldCheckLastRcurly record component.
      Returns:
      the value of the shouldCheckLastRcurly record component