Skip to content

@BindContentProviderPath

xcesco edited this page Apr 6, 2018 · 3 revisions

Used to generate a content provider path for the annotated data source. This annotation can be used only on a DAO definition.

Attributes

  • path: define the segment path associated with DAO.
  • typeName: name of type that content provider returns. If not specified, a class name with authority

Usage

As stated before, this annotation can be used only on a DAO method's interface. A DAO interface that uses this annotation:

@BindContentProviderPath(path = "cheese")
@BindDao(Cheese.class)
public interface CheeseDao {

    @BindSqlSelect(fields="count(*)")
    int count();

    @BindContentProviderEntry
    @BindSqlInsert
    long insert(Cheese cheese);

    @BindContentProviderEntry()
    @BindSqlSelect
    List<Cheese> selectAll();

    @BindContentProviderEntry(path = "${id}")
    @BindSqlSelect(where ="id=${id}")
    Cheese selectById(long id);

    @BindContentProviderEntry(path = "${id}")
    @BindSqlDelete(where ="id=${id}")
    int deleteById(long id);

    @BindContentProviderEntry(path = "${cheese.id}")
    @BindSqlUpdate(where="id=${cheese.id}")
    int update(Cheese cheese);
}

Table of Contents

Query definition

Features

Relations

Multithread supports

Modularization

Annotations for data convertion

Annotations for SQLite ORM

Annotations for shared preferences

Clone this wiki locally