use of org.mongodb.morphia.utils.IndexType in project morphia by mongodb.
the class IndexBuilder method parseFieldsString.
private List<Field> parseFieldsString(final String str) {
List<Field> fields = new ArrayList<Field>();
final String[] parts = str.split(",");
for (String s : parts) {
s = s.trim();
IndexType dir = IndexType.ASC;
if (s.startsWith("-")) {
dir = IndexType.DESC;
s = s.substring(1).trim();
}
fields.add(new FieldBuilder().value(s).type(dir));
}
return fields;
}