public static Optional<Call> maybeCall(Expression expression) {
    Objects.requireNonNull(expression, "expression");
    return expression.accept(new AbstractExpressionVisitor<Optional<Call>>(Optional.empty()) {
      @Override
      public Optional<Call> visit(Call call) {
        return Optional.of(call);
      }
    });
  }
Assumes current expression is a {@link Constant}. Throws exception when it is not.
criteria/common/src/org/immutables/criteria/expression/Visitors.java