-
Notifications
You must be signed in to change notification settings - Fork 16
Live data
About Architecture Components, Live Data and View Model you will find tons of documentation and tutorials. A good place to start is always the official documentation.
Kripton since version 4, can generate live data and so it can be used with the other architectural components. If you want to generate a live data from a DAO simple define a method returning LiveData
type.
An important thing: Kripton supports both Live Data pre-JetPack and Live Data included in Jet Pack suite. To configure Kripton to work with them see Annotation Processor Options
@BindDao(Person.class)
public interface DaoPerson0 {
@BindSqlSelect
LiveData<List<Person>> selectAll();
@BindSqlInsert
void insert(Person bean);
@BindSqlUpdate(where ="id=${bean.id}")
void update(Person bean);
}
And its usage:
// we are in an activity#onCreate
LiveData<List<Person>> liveData = ds.getDaoPerson0().selectAll();
liveData.observe(this, persons -> System.out.println("*********** "+persons.size()));
Kripton, at compile time, will generate all necessary code to manage live data. Note that there is a default executor thread pool to manage async task for live data. If you want to override this behaviour, at application startup, you can setup your executor using the right init
method.
KriptonLibrary.init(contextValue, executorService);
- Introduction
- Goals & Features
- Kotlin
- Immutable or Mutable Pojo
- Annotation Processor Args
- Credits
- Articles
- Benchmarks
- Setup
- Tutorial
- Usage
- Dependencies and inspirations
- Stackoverflow
- Documentation
- SQL logging
- Data source options
- Indices
- SQL Type adapter
- Global SQL Type adapter
- Constraints
- Live data: welcome Architectural components!!
- Paged Live data
- Dynamic parts
- Transactional and batch operations
- Async Transactional and batch operations
- Global transaction
- Support for immutable POJO
- Generate Content provider
- Generate Database schema generation
- Database migration
- BindSqlColumn
- BindContentProvider
- BindContentProviderEntry
- BindContentProviderPath
- BindDao
- BindDaoMany2Many
- BindDataSource
- BindDataSourceOptions
- BindDataSourceUpdateTask
- BindIndex
- BindSqlRelation
- BindSqlAdapter
- BindSqlChildSelect
- BindSqlDelete
- BindSqlDynamicOrderBy
- BindSqlDynamicWhere
- BindSqlDynamicWhereParams
- BindSqlInsert
- BindSqlPageSize
- BindSqlParam
- BindSqlSelect
- BindSqlUpdate
- BindSqlType
- BindSqlTransaction