IfConditionGenerator ifGenerator = new IfConditionGenerator(fact);
// Check @Index and @Unindex conditions
Index indexedAnn = field.getAnnotation(Index.class);
Unindex unindexedAnn = field.getAnnotation(Unindex.class);
if (indexedAnn != null && unindexedAnn != null)
throw new IllegalStateException("Cannot have @Indexed and @Unindexed on the same field: " + field);
if (indexedAnn != null)
this.indexConditions = ifGenerator.generateIfConditions(indexedAnn.value(), field);
if (unindexedAnn != null)
this.unindexConditions = ifGenerator.generateIfConditions(unindexedAnn.value(), field);
// Now watch out for @IgnoreSave conditions
IgnoreSave ignoreSave = field.getAnnotation(IgnoreSave.class);
if (ignoreSave != null)
ignoreSaveConditions = ifGenerator.generateIfConditions(ignoreSave.value(), field);