QueryFactory { static void validateSimpleFunctionGenericTypes(Class<?>[] typeArgs, Class<?> subType) { if (typeArgs == null) { throw new IllegalStateException("Could not resolve any generic type information from the given " + "function of type: " + subType.getName() + ". " + GENERIC_TYPE_RESOLUTION_FAILURE_MESSAGE); } if (typeArgs.length != 2 || typeArgs[0] == TypeResolver.Unknown.class || typeArgs[1] == TypeResolver.Unknown.class) { throw new IllegalStateException("Could not resolve sufficient generic type information from the given " + "function of type: " + subType.getName() + ", resolved: " + Arrays.toString(typeArgs) + ". " + GENERIC_TYPE_RESOLUTION_FAILURE_MESSAGE); } } QueryFactory(); static Equal<O, A> equal(Attribute<O, A> attribute, A attributeValue); static LessThan<O, A> lessThanOrEqualTo(Attribute<O, A> attribute, A attributeValue); static LessThan<O, A> lessThan(Attribute<O, A> attribute, A attributeValue); static GreaterThan<O, A> greaterThanOrEqualTo(Attribute<O, A> attribute, A attributeValue); static GreaterThan<O, A> greaterThan(Attribute<O, A> attribute, A attributeValue); static Between<O, A> between(Attribute<O, A> attribute, A lowerValue, boolean lowerInclusive, A upperValue, boolean upperInclusive); static Between<O, A> between(Attribute<O, A> attribute, A lowerValue, A upperValue); static Query<O> in(Attribute<O, A> attribute, A... attributeValues); static Query<O> in(Attribute<O, A> attribute, Collection<A> attributeValues); static Query<O> in(Attribute<O, A> attribute, boolean disjoint, Collection<A> attributeValues); static StringStartsWith<O, A> startsWith(Attribute<O, A> attribute, A attributeValue); static LongestPrefix<O, A> longestPrefix(Attribute<O, A> attribute, A attributeValue); static Min<O, A> min(Attribute<O, A> attribute); static Max<O, A> max(Attribute<O, A> attribute); static StringIsPrefixOf<O, A> isPrefixOf(Attribute<O, A> attribute, A attributeValue); static StringEndsWith<O, A> endsWith(Attribute<O, A> attribute, A attributeValue); static StringContains<O, A> contains(Attribute<O, A> attribute, A attributeValue); static StringIsContainedIn<O, A> isContainedIn(Attribute<O, A> attribute, A attributeValue); static StringMatchesRegex<O, A> matchesRegex(Attribute<O, A> attribute, Pattern regexPattern); static StringMatchesRegex<O, A> matchesRegex(Attribute<O, A> attribute, String regex); static Has<O, A> has(Attribute<O, A> attribute); static And<O> and(Query<O> query1, Query<O> query2); static And<O> and(Query<O> query1, Query<O> query2, Query<O>... additionalQueries); static And<O> and(Query<O> query1, Query<O> query2, Collection<Query<O>> additionalQueries); static Or<O> or(Query<O> query1, Query<O> query2); static Or<O> or(Query<O> query1, Query<O> query2, Query<O>... additionalQueries); static Or<O> or(Query<O> query1, Query<O> query2, Collection<Query<O>> additionalQueries); static Not<O> not(Query<O> query); static Query<O> existsIn(final IndexedCollection<F> foreignCollection, final Attribute<O, A> localKeyAttribute, final Attribute<F, A> foreignKeyAttribute); static Query<O> existsIn(final IndexedCollection<F> foreignCollection, final Attribute<O, A> localKeyAttribute, final Attribute<F, A> foreignKeyAttribute, final Query<F> foreignRestrictions); static Query<O> all(Class<O> objectType); static Query<O> none(Class<O> objectType); static OrderByOption<O> orderBy(List<AttributeOrder<O>> attributeOrders); static OrderByOption<O> orderBy(AttributeOrder<O>... attributeOrders); static AttributeOrder<O> ascending(Attribute<O, ? extends Comparable> attribute); static AttributeOrder<O> descending(Attribute<O, ? extends Comparable> attribute); static DeduplicationOption deduplicate(DeduplicationStrategy deduplicationStrategy); static IsolationOption isolationLevel(IsolationLevel isolationLevel); static ArgumentValidationOption argumentValidation(ArgumentValidationStrategy strategy); static QueryOptions queryOptions(Object... queryOptions); static QueryOptions queryOptions(Collection<Object> queryOptions); static QueryOptions noQueryOptions(); static FlagsEnabled enableFlags(Object... flags); static FlagsDisabled disableFlags(Object... flags); static Thresholds applyThresholds(Threshold... thresholds); static Threshold threshold(Object key, Double value); static SelfAttribute<O> selfAttribute(Class<O> objectType); static Attribute<Map, A> mapAttribute(K mapKey, Class<A> mapValueType); static Map mapEntity(Map map); static Map primaryKeyedMapEntity(Map map, Object primaryKey); @SuppressWarnings("unchecked") static OrderMissingLastAttribute<O> missingLast(Attribute<O, ? extends Comparable> delegateAttribute); @SuppressWarnings("unchecked") static OrderMissingFirstAttribute<O> missingFirst(Attribute<O, ? extends Comparable> delegateAttribute); static StandingQueryAttribute<O> forStandingQuery(Query<O> standingQuery); static StandingQueryAttribute<O> forObjectsMissing(Attribute<O, A> attribute); static SimpleAttribute<O, A> attribute(SimpleFunction<O, A> function); static SimpleAttribute<O, A> attribute(String attributeName, SimpleFunction<O, A> function); static SimpleAttribute<O, A> attribute(Class<O> objectType, Class<A> attributeType, String attributeName, SimpleFunction<O, A> function); static SimpleNullableAttribute<O, A> nullableAttribute(SimpleFunction<O, A> function); static SimpleNullableAttribute<O, A> nullableAttribute(String attributeName, SimpleFunction<O, A> function); static SimpleNullableAttribute<O, A> nullableAttribute(Class<O> objectType, Class<A> attributeType, String attributeName, SimpleFunction<O, A> function); static MultiValueAttribute<O, A> attribute(Class<A> attributeType, MultiValueFunction<O, A, I> function); static MultiValueAttribute<O, A> attribute(Class<A> attributeType, String attributeName, MultiValueFunction<O, A, I> function); static MultiValueAttribute<O, A> attribute(Class<O> objectType, Class<A> attributeType, String attributeName, MultiValueFunction<O, A, I> function); static MultiValueNullableAttribute<O, A> nullableAttribute(Class<A> attributeType, MultiValueFunction<O, A, I> function); static MultiValueNullableAttribute<O, A> nullableAttribute(Class<A> attributeType, String attributeName, MultiValueFunction<O, A, I> function); static MultiValueNullableAttribute<O, A> nullableAttribute(Class<O> objectType, Class<A> attributeType, String attributeName, MultiValueFunction<O, A, I> function); @SuppressWarnings({"JavaDoc"}) static And<O> and(Query<O> query1, Query<O> query2, Query<O> query3); @SuppressWarnings({"JavaDoc"}) static And<O> and(Query<O> query1, Query<O> query2, Query<O> query3, Query<O> query4); @SuppressWarnings({"JavaDoc"}) static And<O> and(Query<O> query1, Query<O> query2, Query<O> query3, Query<O> query4, Query<O> query5); @SuppressWarnings({"JavaDoc"}) static Or<O> or(Query<O> query1, Query<O> query2, Query<O> query3); @SuppressWarnings({"JavaDoc"}) static Or<O> or(Query<O> query1, Query<O> query2, Query<O> query3, Query<O> query4); @SuppressWarnings({"JavaDoc"}) static Or<O> or(Query<O> query1, Query<O> query2, Query<O> query3, Query<O> query4, Query<O> query5); @SuppressWarnings({"JavaDoc"}) static OrderByOption<O> orderBy(AttributeOrder<O> attributeOrder); @SuppressWarnings({"JavaDoc"}) static OrderByOption<O> orderBy(AttributeOrder<O> attributeOrder1, AttributeOrder<O> attributeOrder2); @SuppressWarnings({"JavaDoc"}) static OrderByOption<O> orderBy(AttributeOrder<O> attributeOrder1, AttributeOrder<O> attributeOrder2,
                                             AttributeOrder<O> attributeOrder3); @SuppressWarnings({"JavaDoc"}) static OrderByOption<O> orderBy(AttributeOrder<O> attributeOrder1, AttributeOrder<O> attributeOrder2,
                                             AttributeOrder<O> attributeOrder3, AttributeOrder<O> attributeOrder4); @SuppressWarnings({"JavaDoc"}) static OrderByOption<O> orderBy(AttributeOrder<O> attributeOrder1, AttributeOrder<O> attributeOrder2,
                                             AttributeOrder<O> attributeOrder3, AttributeOrder<O> attributeOrder4,
                                             AttributeOrder<O> attributeOrder5); static Predicate<O> predicate(Query<O> query); static Predicate<O> predicate(Query<O> query, QueryOptions queryOptions); @SuppressWarnings({"JavaDoc"}) static QueryOptions queryOptions(Object queryOption); @SuppressWarnings({"JavaDoc"}) static QueryOptions queryOptions(Object queryOption1, Object queryOption2);  }
@Test public void testValidateSimpleFunctionGenericTypes_Success() { Class<?>[] typeArgs = new Class<?>[] {Car.class, Integer.class}; validateSimpleFunctionGenericTypes(typeArgs, SimpleFunction.class); }
@Test(expected = IllegalStateException.class) public void testValidateSimpleFunctionGenericTypes_NullTypeArgs() { validateSimpleFunctionGenericTypes(null, SimpleFunction.class); }
@Test(expected = IllegalStateException.class) public void testValidateSimpleFunctionGenericTypes_IncorrectNumberOfTypeArgs() { Class<?>[] typeArgs = new Class<?>[] {Car.class, Integer.class, Integer.class}; validateSimpleFunctionGenericTypes(typeArgs, SimpleFunction.class); }
@Test(expected = IllegalStateException.class) public void testValidateSimpleFunctionGenericTypes_InvalidTypeArgs1() { Class<?>[] typeArgs = new Class<?>[] {TypeResolver.Unknown.class, Integer.class}; validateSimpleFunctionGenericTypes(typeArgs, SimpleFunction.class); }
@Test(expected = IllegalStateException.class) public void testValidateSimpleFunctionGenericTypes_InvalidTypeArgs2() { Class<?>[] typeArgs = new Class<?>[] {Car.class, TypeResolver.Unknown.class}; validateSimpleFunctionGenericTypes(typeArgs, SimpleFunction.class); }