Interface Criterion

All Known Implementing Classes:
ASTPathCriterion, BoundLocationCriterion, CallCriterion, CastCriterion, ClassBoundCriterion, ExtImplsLocationCriterion, FieldCriterion, GenericArrayLocationCriterion, InClassCriterion, InFieldInitCriterion, InInitBlockCriterion, InstanceOfCriterion, IntersectionTypeLocationCriterion, IsSigMethodCriterion, LambdaCriterion, LocalVariableCriterion, MemberReferenceCriterion, MethodBoundCriterion, NewCriterion, ParamCriterion, ReceiverCriterion, ReturnTypeCriterion, TypeArgumentCriterion

public interface Criterion
A criterion for locating a program element in an AST. A Criterion does not actually give a location. Given a location, the isSatisfiedBy method indicates whether that location is a desired one.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    Types of criterion.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the type of this criterion.
    boolean
    Returns true if this Criterion only permits type annotations, not declaration annotations.
    boolean
    Determines if the given tree path is satisfied by this criterion.
    boolean
    Determines if the given tree path is satisfied by this criterion.
  • Method Details

    • isSatisfiedBy

      boolean isSatisfiedBy(@Nullable TreePath path, @FindDistinct Tree leaf)
      Determines if the given tree path is satisfied by this criterion.
      Parameters:
      path - the tree path to check against. May be null (in which case the result is false), for example in a call such as this.isSatisfiedBy(path.getParentPath()).
      Returns:
      true if this criterion is satisfied by the given path, false otherwise
    • isSatisfiedBy

      boolean isSatisfiedBy(@Nullable TreePath path)
      Determines if the given tree path is satisfied by this criterion.
      Parameters:
      path - the tree path to check against. May be null (in which case the result is false), for example in a call such as this.isSatisfiedBy(path.getParentPath()).
      Returns:
      true if this criterion is satisfied by the given path, false otherwise
    • isOnlyTypeAnnotationCriterion

      boolean isOnlyTypeAnnotationCriterion()
      Returns true if this Criterion only permits type annotations, not declaration annotations.
      Returns:
      true if this Criterion only permits type annotations, not declaration annotations
    • getKind

      Criterion.Kind getKind()
      Gets the type of this criterion.
      Returns:
      this criterion's kind