Interface AbstractMockChecker.TypeExtractor<T extends com.sun.source.tree.Tree>

Type Parameters:
T - the type of Tree that this TypeExtractor operates on
Enclosing class:
AbstractMockChecker<T extends Annotation>

public static interface AbstractMockChecker.TypeExtractor<T extends com.sun.source.tree.Tree>
An extension of Matcher to return, not just a boolean `matches`, but also extract some type information about the Tree of interest.

This is used to identify what classes are being mocked in a Tree.

  • Method Details

    • extract

      Optional<com.sun.tools.javac.code.Type> extract​(T tree, VisitorState state)
      Investigate the provided Tree, and return type information about it if it matches.
      Returns:
      the Type of the object being mocked, if any; Optional.empty() otherwise
    • or

      Enrich this TypeExtractor with fallback behavior.
      Returns:
      a TypeExtractor which first tries this.extract(t, s), and if that does not match, falls back to other.extract(t, s).