@Test void testQueryValues() { Attribute attribute = when(mock(Attribute.class).getDataType()).thenReturn(STRING).getMock(); assertEquals( asList("string0", "string1"), queryGenerator.getQueryValues(attribute, asList("string0", "string1"))); }
@SuppressWarnings("UnstableApiUsage") List<Object> getQueryValues(Attribute attr, Object queryRuleValue) { if (queryRuleValue == null) { throw new MolgenisQueryException(QUERY_VALUE_CANNOT_BE_NULL_MSG); } if (!(queryRuleValue instanceof Iterable<?>)) { throw new MolgenisQueryException( "Query value must be a Iterable instead of [" + queryRuleValue.getClass().getSimpleName() + "]"); } return Streams.stream((Iterable<?>) queryRuleValue) .map(aQueryRuleValue -> getQueryValue(attr, aQueryRuleValue)) .collect(toList()); }
BaseQueryClauseGenerator implements QueryClauseGenerator { @SuppressWarnings("UnstableApiUsage") List<Object> getQueryValues(Attribute attr, Object queryRuleValue) { if (queryRuleValue == null) { throw new MolgenisQueryException(QUERY_VALUE_CANNOT_BE_NULL_MSG); } if (!(queryRuleValue instanceof Iterable<?>)) { throw new MolgenisQueryException( "Query value must be a Iterable instead of [" + queryRuleValue.getClass().getSimpleName() + "]"); } return Streams.stream((Iterable<?>) queryRuleValue) .map(aQueryRuleValue -> getQueryValue(attr, aQueryRuleValue)) .collect(toList()); } }
BaseQueryClauseGenerator implements QueryClauseGenerator { @SuppressWarnings("UnstableApiUsage") List<Object> getQueryValues(Attribute attr, Object queryRuleValue) { if (queryRuleValue == null) { throw new MolgenisQueryException(QUERY_VALUE_CANNOT_BE_NULL_MSG); } if (!(queryRuleValue instanceof Iterable<?>)) { throw new MolgenisQueryException( "Query value must be a Iterable instead of [" + queryRuleValue.getClass().getSimpleName() + "]"); } return Streams.stream((Iterable<?>) queryRuleValue) .map(aQueryRuleValue -> getQueryValue(attr, aQueryRuleValue)) .collect(toList()); } BaseQueryClauseGenerator(DocumentIdGenerator documentIdGenerator, Operator operator); }
BaseQueryClauseGenerator implements QueryClauseGenerator { @SuppressWarnings("UnstableApiUsage") List<Object> getQueryValues(Attribute attr, Object queryRuleValue) { if (queryRuleValue == null) { throw new MolgenisQueryException(QUERY_VALUE_CANNOT_BE_NULL_MSG); } if (!(queryRuleValue instanceof Iterable<?>)) { throw new MolgenisQueryException( "Query value must be a Iterable instead of [" + queryRuleValue.getClass().getSimpleName() + "]"); } return Streams.stream((Iterable<?>) queryRuleValue) .map(aQueryRuleValue -> getQueryValue(attr, aQueryRuleValue)) .collect(toList()); } BaseQueryClauseGenerator(DocumentIdGenerator documentIdGenerator, Operator operator); @Override Operator getOperator(); @Override QueryBuilder createQueryClause(QueryRule queryRule, EntityType entityType); }
BaseQueryClauseGenerator implements QueryClauseGenerator { @SuppressWarnings("UnstableApiUsage") List<Object> getQueryValues(Attribute attr, Object queryRuleValue) { if (queryRuleValue == null) { throw new MolgenisQueryException(QUERY_VALUE_CANNOT_BE_NULL_MSG); } if (!(queryRuleValue instanceof Iterable<?>)) { throw new MolgenisQueryException( "Query value must be a Iterable instead of [" + queryRuleValue.getClass().getSimpleName() + "]"); } return Streams.stream((Iterable<?>) queryRuleValue) .map(aQueryRuleValue -> getQueryValue(attr, aQueryRuleValue)) .collect(toList()); } BaseQueryClauseGenerator(DocumentIdGenerator documentIdGenerator, Operator operator); @Override Operator getOperator(); @Override QueryBuilder createQueryClause(QueryRule queryRule, EntityType entityType);  }