Class Jsr305AnnotationsCheck.AbstractJsr305Handler

  • Enclosing class:
    Jsr305AnnotationsCheck

    public abstract class Jsr305AnnotationsCheck.AbstractJsr305Handler
    extends Object
    An abstract handler, the base for handling parameters, methods, classes.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void checkContainsAll​(String msg, com.github.sevntu.checkstyle.checks.coding.Jsr305AnnotationsCheck.NullnessAnnotation... search)
      Emits a violation if all given annotations are found.
      protected void checkContainsAny​(String msg, com.github.sevntu.checkstyle.checks.coding.Jsr305AnnotationsCheck.NullnessAnnotation... search)
      Emits a violation if any of the given annotations are found.
      protected void checkContainsNone​(String msg, com.github.sevntu.checkstyle.checks.coding.Jsr305AnnotationsCheck.NullnessAnnotation... search)
      Make sure that none of the given annotations are present.
      protected void checkRedundancyDueToClassLevelAnnotation​(String msg, com.github.sevntu.checkstyle.checks.coding.Jsr305AnnotationsCheck.NullnessAnnotation... search)
      Emits a violation if both this and the parent class have redundant nullness annotations.
      protected com.puppycrawl.tools.checkstyle.api.DetailAST getAst()
      Returns the ast.
      protected com.github.sevntu.checkstyle.checks.coding.Jsr305AnnotationsCheck.NullnessAnnotation getParentMethodOrClassAnnotation​(com.github.sevntu.checkstyle.checks.coding.Jsr305AnnotationsCheck.NullnessAnnotation... annotationsToLookFor)
      Gets the nullness annotation for the parent method or class.
      void handle()
      Run the actual handler.
      protected boolean isMethodOverridden()
      Is the current method overridden.
      protected abstract void runHandler()
      Run the actual handler.
    • Method Detail

      • handle

        public final void handle()
        Run the actual handler.
      • runHandler

        protected abstract void runHandler()
        Run the actual handler.
      • getAst

        protected com.puppycrawl.tools.checkstyle.api.DetailAST getAst()
        Returns the ast.
        Returns:
        the ast
      • checkContainsAny

        protected void checkContainsAny​(String msg,
                                        com.github.sevntu.checkstyle.checks.coding.Jsr305AnnotationsCheck.NullnessAnnotation... search)
        Emits a violation if any of the given annotations are found.
        Parameters:
        msg - the violation message to emit
        search - the annotations to look for
      • checkContainsAll

        protected void checkContainsAll​(String msg,
                                        com.github.sevntu.checkstyle.checks.coding.Jsr305AnnotationsCheck.NullnessAnnotation... search)
        Emits a violation if all given annotations are found.
        Parameters:
        msg - the violation message to emit
        search - the annotations to look for
      • checkRedundancyDueToClassLevelAnnotation

        protected void checkRedundancyDueToClassLevelAnnotation​(String msg,
                                                                com.github.sevntu.checkstyle.checks.coding.Jsr305AnnotationsCheck.NullnessAnnotation... search)
        Emits a violation if both this and the parent class have redundant nullness annotations.
        Parameters:
        msg - the violation message to emit
        search - the annotations to look for
      • checkContainsNone

        protected void checkContainsNone​(String msg,
                                         com.github.sevntu.checkstyle.checks.coding.Jsr305AnnotationsCheck.NullnessAnnotation... search)
        Make sure that none of the given annotations are present.
        Parameters:
        msg - the violation message to emit if one of the given annotations was found
        search - the annotations to look for
      • getParentMethodOrClassAnnotation

        protected com.github.sevntu.checkstyle.checks.coding.Jsr305AnnotationsCheck.NullnessAnnotation getParentMethodOrClassAnnotation​(com.github.sevntu.checkstyle.checks.coding.Jsr305AnnotationsCheck.NullnessAnnotation... annotationsToLookFor)
        Gets the nullness annotation for the parent method or class.
        Parameters:
        annotationsToLookFor - the annotations to look for.
        Returns:
        the annotation or null if none was found
      • isMethodOverridden

        protected boolean isMethodOverridden()
        Is the current method overridden.
        Returns:
        true if yes