All Implemented Interfaces:
Configurable, Contextualizable
Direct Known Subclasses:
ParenPadCheck, TypecastParenPadCheck

public abstract class AbstractParenPadCheck extends AbstractCheck
Abstract class for checking the padding of parentheses. That is whether a space is required after a left parenthesis and before a right parenthesis, or such spaces are forbidden.
  • Field Details

    • OPEN_PARENTHESIS

      private static final char OPEN_PARENTHESIS
      Open parenthesis literal.
      See Also:
    • CLOSE_PARENTHESIS

      private static final char CLOSE_PARENTHESIS
      Close parenthesis literal.
      See Also:
    • msgWsFollowed

      private final String msgWsFollowed
      Message key for followed whitespace.
    • msgWsNotFollowed

      private final String msgWsNotFollowed
      Message key for not followed whitespace.
    • msgWsPreceded

      private final String msgWsPreceded
      Message key for preceded whitespace.
    • msgWsNotPreceded

      private final String msgWsNotPreceded
      Message key for not preceded whitespace.
    • option

      private PadOption option
      The policy to enforce.
  • Constructor Details

    • AbstractParenPadCheck

      protected AbstractParenPadCheck(String msgWsFollowed, String msgWsNotFollowed, String msgWsPreceded, String msgWsNotPreceded)
      Creates a new AbstractParenPadCheck instance.
      Parameters:
      msgWsFollowed - message key for followed whitespace
      msgWsNotFollowed - message key for not followed whitespace
      msgWsPreceded - message key for preceded whitespace
      msgWsNotPreceded - message key for not preceded whitespace
  • Method Details

    • setOption

      public void setOption(String optionStr)
      Specify policy on how to pad parentheses.
      Parameters:
      optionStr - string to decode option from
      Throws:
      IllegalArgumentException - if unable to decode
    • processLeft

      protected void processLeft(DetailAST ast)
      Process a token representing a left parentheses.
      Parameters:
      ast - the token representing a left parentheses
    • processRight

      protected void processRight(DetailAST ast)
      Process a token representing a right parentheses.
      Parameters:
      ast - the token representing a right parentheses