Sugar ORM 中的 count() 方法是否有任何理由采用 String[] 参数而不是 String...?

Is there any reason for count() method in Sugar ORM to take String[] parameter instead of String...?

我正在开发一个简单的测验解决应用程序,在数据库中,问题和测验之间存在多对一关系,因此可以为一个测验分配多个问题。

要获得测验的每个问题,我只需致电:

Question.find(Question.class, "quiz = ?", String.valueOf(quiz.getId()));

虽然有时候想知道有多少题,我想我可以做:

Question.count(Question.class, "quiz = ?", String.valueOf(quiz.getId()));

不幸的是,与 find() 不同,SugarRecord.count() 方法接受 String 的数组,所以我必须这样称呼它:

Question.count(Question.class, "quiz = ?", new String[]{String.valueOf(quiz.getId())});

API 中出现这种不一致有什么原因吗?

原因是重载的使用。有一个 groupBy, orderBylimit 的方法。笨笨笨笨

public static <T> long count(Class<T> type); 
public static <T> long count(Class<T> type, String whereClause, String[] whereArgs);
public static <T> long count(Class<T> type, String whereClause,
        String[] whereArgs, String groupBy, String orderBy, String limit);

但是自己制作:

public static <T> long countWhere(Class<T> type, String whereClause, String... whereArgs) {
     return Question.count(type, whereClause, whereArgs);
}