/** * Calculates the minimum value on a given column. The value is returned * with the same data type of the column. * * <pre> * LitePal.min("person", "age", int.class); * </pre> * * You can also specify a where clause when calculating. * * <pre> * LitePal.where("age > ?", "15").min("person", "age", Integer.TYPE); * </pre> * * @param tableName * Which table to query from. * @param columnName * The based on column to calculate. * @param columnType * The type of the based on column. * @return The minimum value on a given column. */ public static <T> T min(String tableName, String columnName, Class<T> columnType) { return Operator.min(tableName, columnName, columnType); }
/** * Calculates the minimum value on a given column. The value is returned * with the same data type of the column. * * <pre> * LitePal.min(Person.class, "age", int.class); * </pre> * * You can also specify a where clause when calculating. * * <pre> * LitePal.where("age > ?", "15").min(Person.class, "age", Integer.TYPE); * </pre> * * @param modelClass * Which table to query from by class. * @param columnName * The based on column to calculate. * @param columnType * The type of the based on column. * @return The minimum value on a given column. */ public static <T> T min(Class<?> modelClass, String columnName, Class<T> columnType) { return Operator.min(modelClass, columnName, columnType); }
@Override public void run() { synchronized (LitePalSupport.class) { final T t = min(tableName, columnName, columnType); if (executor.getListener() != null) { Operator.getHandler().post(new Runnable() { @Override public void run() { executor.getListener().onFinish(t); } }); } } } };
/** * Calculates the minimum value on a given column. The value is returned * with the same data type of the column. * * <pre> * LitePal.min(Person.class, "age", int.class); * </pre> * * You can also specify a where clause when calculating. * * <pre> * LitePal.where("age > ?", "15").min(Person.class, "age", Integer.TYPE); * </pre> * * @param modelClass * Which table to query from by class. * @param columnName * The based on column to calculate. * @param columnType * The type of the based on column. * @return The minimum value on a given column. */ public static <T> T min(Class<?> modelClass, String columnName, Class<T> columnType) { return min(BaseUtility.changeCase(DBUtility.getTableNameByClassName(modelClass.getName())), columnName, columnType); }