/** * @param clazz * @param name * @param fields * @param unique * @param dropDupsOnCreate * @param <T> */ public <T> void ensureIndex(Class<T> clazz, String name, String fields, boolean unique, boolean dropDupsOnCreate) { ensureIndex(clazz, name, QueryImpl.parseFieldsString(fields, clazz, mapr, true), unique, dropDupsOnCreate, false, false, -1); }
/** * @param clazz * @param name * @param fields * @param unique * @param dropDupsOnCreate * @param background * @param <T> */ public <T> void ensureIndex(Class<T> clazz, String name, String fields, boolean unique, boolean dropDupsOnCreate, boolean background) { ensureIndex(clazz, name, QueryImpl.parseFieldsString(fields, clazz, mapr, true), unique, dropDupsOnCreate, background, false, -1); }
public Query<T> order(String condition) { if (snapshotted) throw new QueryException("order cannot be used on a snapshotted query."); //reset order if (condition == null || condition.trim().isEmpty()) sort = null; sort = parseFieldsString(condition, clazz, this.ds.getMapper(), this.validateName); return this; }
/** * Ensure indexes from class annotation * @param mc * @param background */ private void ensureIndexesFromClassAnnotation(MappedClass mc, boolean background) { ArrayList<Annotation> idxs = mc.getAnnotations(Indexes.class); if (idxs != null) for (Annotation ann : idxs) { Indexes idx = (Indexes) ann; if (idx != null && idx.value() != null && idx.value().length > 0) for (Index index : idx.value()) { BasicDBObject fields = QueryImpl.parseFieldsString(index.value(), mc.getClazz(), mapr, !index.disableValidation()); ensureIndex(mc.getClazz(), index.name(), fields, index.unique(), index.dropDups(), index.background() ? index.background() : background, index.sparse() ? index.sparse() : false, index.expireAfterSeconds()); } } }