protected FieldCriteria(QueryImpl<?> query, String field, FilterOperator op, Object value, boolean validateNames, boolean validateTypes, boolean not) {
StringBuffer sb = new StringBuffer(field); //validate might modify prop string to translate java field name to db field name
MappedField mf = DefaultMapper.validate(query.getEntityClass(), query.getDatastore().getMapper(), sb, op, value, validateNames, validateTypes);
field = sb.toString();
Mapper mapr = query.getDatastore().getMapper();
MappedClass mc = null;
try {
if (value != null && !ReflectionUtils.isPropertyType(value.getClass()) && !ReflectionUtils.implementsInterface(value.getClass(), Iterable.class))
if (mf != null && !mf.isTypeMongoCompatible())
mc = mapr.getMappedClass((mf.isSingleValue()) ? mf.getType() : mf.getSubClass());
else
mc = mapr.getMappedClass(value);
} catch (Exception e) {
//Ignore these. It is likely they related to mapping validation that is unimportant for queries (the query will fail/return-empty anyway)
log.debug("Error during mapping of filter criteria: ", e);
}
Object mappedValue = mapr.toMongoObject(mf, mc, value);
Class<?> type = (mappedValue == null) ? null : mappedValue.getClass();
//convert single values into lists for $in/$nin
if (type != null && (op == FilterOperator.IN || op == FilterOperator.NOT_IN) && !type.isArray() && !Iterable.class.isAssignableFrom(type)) {