in src/main/java/com/google/firebase/database/Query.java [84:112]
private void validateQueryEndpoints(QueryParams params) {
if (params.getIndex().equals(KeyIndex.getInstance())) {
String message =
"You must use startAt(String value), endAt(String value) or "
+ "equalTo(String value) in combination with orderByKey(). Other type of values or "
+ "using the version with 2 parameters is not supported";
if (params.hasStart()) {
Node startNode = params.getIndexStartValue();
ChildKey startName = params.getIndexStartName();
if (startName != ChildKey.getMinName() || !(startNode instanceof StringNode)) {
throw new IllegalArgumentException(message);
}
}
if (params.hasEnd()) {
Node endNode = params.getIndexEndValue();
ChildKey endName = params.getIndexEndName();
if (endName != ChildKey.getMaxName() || !(endNode instanceof StringNode)) {
throw new IllegalArgumentException(message);
}
}
} else if (params.getIndex().equals(PriorityIndex.getInstance())) {
if ((params.hasStart() && !PriorityUtilities.isValidPriority(params.getIndexStartValue()))
|| (params.hasEnd() && !PriorityUtilities.isValidPriority(params.getIndexEndValue()))) {
throw new IllegalArgumentException(
"When using orderByPriority(), values provided to startAt(), "
+ "endAt(), or equalTo() must be valid priorities.");
}
}
}