本文整理汇总了Java中org.litepal.LitePal类的典型用法代码示例。如果您正苦于以下问题:Java LitePal类的具体用法?Java LitePal怎么用?Java LitePal使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LitePal类属于org.litepal包,在下文中一共展示了LitePal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findAsync
import org.litepal.LitePal; //导入依赖的package包/类
/**
* Basically same as {@link #find(Class, boolean)} but pending to a new thread for executing.
*
* @param modelClass
* Which table to query and the object type to return as a list.
* @param isEager
* True to load the associated models, false not.
* @return A FindMultiExecutor instance.
*/
public <T> FindMultiExecutor findAsync(final Class<T> modelClass, final boolean isEager) {
final FindMultiExecutor executor = new FindMultiExecutor();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (DataSupport.class) {
final List<T> t = find(modelClass, isEager);
if (executor.getListener() != null) {
LitePal.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(t);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
示例2: findFirstAsync
import org.litepal.LitePal; //导入依赖的package包/类
/**
* Basically same as {@link #findFirst(Class, boolean)} but pending to a new thread for executing.
*
* @param modelClass
* Which table to query and the object type to return.
* @param isEager
* True to load the associated models, false not.
* @return A FindExecutor instance.
*/
public <T> FindExecutor findFirstAsync(final Class<T> modelClass, final boolean isEager) {
final FindExecutor executor = new FindExecutor();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (DataSupport.class) {
final T t = findFirst(modelClass, isEager);
if (executor.getListener() != null) {
LitePal.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(t);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
示例3: findLastAsync
import org.litepal.LitePal; //导入依赖的package包/类
/**
* Basically same as {@link #findLast(Class, boolean)} but pending to a new thread for executing.
*
* @param modelClass
* Which table to query and the object type to return.
* @param isEager
* True to load the associated models, false not.
* @return A FindExecutor instance.
*/
public <T> FindExecutor findLastAsync(final Class<T> modelClass, final boolean isEager) {
final FindExecutor executor = new FindExecutor();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (DataSupport.class) {
final T t = findLast(modelClass, isEager);
if (executor.getListener() != null) {
LitePal.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(t);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
示例4: countAsync
import org.litepal.LitePal; //导入依赖的package包/类
/**
* Basically same as {@link #count(String)} but pending to a new thread for executing.
*
* @param tableName
* Which table to query from.
* @return A CountExecutor instance.
*/
public CountExecutor countAsync(final String tableName) {
final CountExecutor executor = new CountExecutor();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (DataSupport.class) {
final int count = count(tableName);
if (executor.getListener() != null) {
LitePal.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(count);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
示例5: averageAsync
import org.litepal.LitePal; //导入依赖的package包/类
/**
* Basically same as {@link #average(String, String)} but pending to a new thread for executing.
*
* @param tableName
* Which table to query from.
* @param column
* The based on column to calculate.
* @return A AverageExecutor instance.
*/
public AverageExecutor averageAsync(final String tableName, final String column) {
final AverageExecutor executor = new AverageExecutor();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (DataSupport.class) {
final double average = average(tableName, column);
if (executor.getListener() != null) {
LitePal.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(average);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
示例6: maxAsync
import org.litepal.LitePal; //导入依赖的package包/类
/**
* Basically same as {@link #max(String, String, Class)} but pending to a new thread for executing.
*
* @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 A FindExecutor instance.
*/
public <T> FindExecutor maxAsync(final String tableName, final String columnName, final Class<T> columnType) {
final FindExecutor executor = new FindExecutor();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (DataSupport.class) {
final T t = max(tableName, columnName, columnType);
if (executor.getListener() != null) {
LitePal.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(t);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
示例7: minAsync
import org.litepal.LitePal; //导入依赖的package包/类
/**
* Basically same as {@link #min(String, String, Class)} but pending to a new thread for executing.
*
* @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 A FindExecutor instance.
*/
public <T> FindExecutor minAsync(final String tableName, final String columnName, final Class<T> columnType) {
final FindExecutor executor = new FindExecutor();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (DataSupport.class) {
final T t = min(tableName, columnName, columnType);
if (executor.getListener() != null) {
LitePal.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(t);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
示例8: sumAsync
import org.litepal.LitePal; //导入依赖的package包/类
/**
* Basically same as {@link #sum(String, String, Class)} but pending to a new thread for executing.
*
* @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 A FindExecutor instance.
*/
public <T> FindExecutor sumAsync(final String tableName, final String columnName, final Class<T> columnType) {
final FindExecutor executor = new FindExecutor();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (DataSupport.class) {
final T t = sum(tableName, columnName, columnType);
if (executor.getListener() != null) {
LitePal.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(t);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
示例9: countAsync
import org.litepal.LitePal; //导入依赖的package包/类
/**
* Basically same as {@link #count(String)} but pending to a new thread for executing.
*
* @param tableName
* Which table to query from.
* @return A CountExecutor instance.
*/
public static CountExecutor countAsync(final String tableName) {
final CountExecutor executor = new CountExecutor();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (DataSupport.class) {
final int count = count(tableName);
if (executor.getListener() != null) {
LitePal.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(count);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
示例10: averageAsync
import org.litepal.LitePal; //导入依赖的package包/类
/**
* Basically same as {@link #average(String, String)} but pending to a new thread for executing.
*
* @param tableName
* Which table to query from.
* @param column
* The based on column to calculate.
* @return A AverageExecutor instance.
*/
public static AverageExecutor averageAsync(final String tableName, final String column) {
final AverageExecutor executor = new AverageExecutor();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (DataSupport.class) {
final double average = average(tableName, column);
if (executor.getListener() != null) {
LitePal.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(average);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
示例11: maxAsync
import org.litepal.LitePal; //导入依赖的package包/类
/**
* Basically same as {@link #max(String, String, Class)} but pending to a new thread for executing.
*
* @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 A FindExecutor instance.
*/
public static <T> FindExecutor maxAsync(final String tableName, final String columnName, final Class<T> columnType) {
final FindExecutor executor = new FindExecutor();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (DataSupport.class) {
final T t = max(tableName, columnName, columnType);
if (executor.getListener() != null) {
LitePal.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(t);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
示例12: minAsync
import org.litepal.LitePal; //导入依赖的package包/类
/**
* Basically same as {@link #min(String, String, Class)} but pending to a new thread for executing.
*
* @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 A FindExecutor instance.
*/
public static <T> FindExecutor minAsync(final String tableName, final String columnName, final Class<T> columnType) {
final FindExecutor executor = new FindExecutor();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (DataSupport.class) {
final T t = min(tableName, columnName, columnType);
if (executor.getListener() != null) {
LitePal.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(t);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
示例13: sumAsync
import org.litepal.LitePal; //导入依赖的package包/类
/**
* Basically same as {@link #sum(String, String, Class)} but pending to a new thread for executing.
*
* @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 A FindExecutor instance.
*/
public static <T> FindExecutor sumAsync(final String tableName, final String columnName, final Class<T> columnType) {
final FindExecutor executor = new FindExecutor();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (DataSupport.class) {
final T t = sum(tableName, columnName, columnType);
if (executor.getListener() != null) {
LitePal.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(t);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
示例14: findAsync
import org.litepal.LitePal; //导入依赖的package包/类
/**
* Basically same as {@link #find(Class, long, boolean)} but pending to a new thread for executing.
*
* @param modelClass
* Which table to query and the object type to return.
* @param id
* Which record to query.
* @param isEager
* True to load the associated models, false not.
* @return A FindExecutor instance.
*/
public static <T> FindExecutor findAsync(final Class<T> modelClass, final long id, final boolean isEager) {
final FindExecutor executor = new FindExecutor();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (DataSupport.class) {
final T t = find(modelClass, id, isEager);
if (executor.getListener() != null) {
LitePal.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(t);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}
示例15: findFirstAsync
import org.litepal.LitePal; //导入依赖的package包/类
/**
* Basically same as {@link #findFirstAsync(Class, boolean)} but pending to a new thread for executing.
*
* @param modelClass
* Which table to query and the object type to return.
* @param isEager
* True to load the associated models, false not.
* @return A FindExecutor instance.
*/
public static <T> FindExecutor findFirstAsync(final Class<T> modelClass, final boolean isEager) {
final FindExecutor executor = new FindExecutor();
Runnable runnable = new Runnable() {
@Override
public void run() {
synchronized (DataSupport.class) {
final T t = findFirst(modelClass, isEager);
if (executor.getListener() != null) {
LitePal.getHandler().post(new Runnable() {
@Override
public void run() {
executor.getListener().onFinish(t);
}
});
}
}
}
};
executor.submit(runnable);
return executor;
}