Class CreatesMustCallForToJavaExpression


  • public class CreatesMustCallForToJavaExpression
    extends java.lang.Object
    Utility methods to convert targets of @CreatesMustCallFor annotations to JavaExpressions.
    • Method Detail

      • getCreatesMustCallForExpressionsAtInvocation

        public static java.util.List<JavaExpression> getCreatesMustCallForExpressionsAtInvocation​(MethodInvocationNode n,
                                                                                                  GenericAnnotatedTypeFactory<?,​?,​?,​?> atypeFactory,
                                                                                                  CreatesMustCallForElementSupplier supplier)
        Returns the elements of the @CreatesMustCallFor annotations on the invoked method, as JavaExpressions. Returns the empty set if the given method has no @CreatesMustCallFor annotation.

        If any expression is unparseable, this method reports an error and returns the empty set.

        Parameters:
        n - a method invocation
        atypeFactory - the type factory to report errors and parse the expression string
        supplier - a type factory that can supply the executable elements for CreatesMustCallFor and CreatesMustCallFor.List's value elements. Usually, you should just pass atypeFactory again. The arguments are different so that the given type factory's adherence to both protocols are checked by the type system.
        Returns:
        the arguments of the method's @CreatesMustCallFor annotation, or an empty list
      • getCreatesMustCallForExpressionsAtMethodDeclaration

        public static java.util.List<JavaExpression> getCreatesMustCallForExpressionsAtMethodDeclaration​(com.sun.source.tree.MethodTree tree,
                                                                                                         GenericAnnotatedTypeFactory<?,​?,​?,​?> atypeFactory,
                                                                                                         CreatesMustCallForElementSupplier supplier)
        Returns the elements of the @CreatesMustCallFor annotations on the method declaration, as JavaExpressions. Returns the empty set if the given method has no @CreatesMustCallFor annotation.

        If any expression is unparseable, this method reports an error and returns the empty set.

        Parameters:
        tree - a method declaration
        atypeFactory - the type factory to report errors and parse the expression string
        supplier - a type factory that can supply the executable elements for CreatesMustCallFor and CreatesMustCallFor.List's value elements. Usually, you should just pass atypeFactory again. The arguments are different so that the given type factory's adherence to both protocols are checked by the type system.
        Returns:
        the arguments of the method's @CreatesMustCallFor annotation, or an empty list