public static Query toQuery(Criterion<?> criteria) {
    Objects.requireNonNull(criteria, "criteria");

    if (criteria instanceof Queryable) {
      return ((Queryable) criteria).query();
    }

    return Matchers.extract(criteria).query();
  }
Extracts {@link Query} from a criteria. Any criteria implements (or holds)
{@code Queryable} interface at runtime.
criteria/common/src/org/immutables/criteria/Criterias.java