Skip to content

@BindContentProviderEntry

xcesco edited this page Apr 6, 2018 · 4 revisions

Used to manage a URI managed by a content provider path for the annotated data source. This annotation can be used only on methods of DAO definition.

To use this annotation on DAO method, there are some constraints to respect.

Insert constraints

return type must be the primary key value (an integer or a long or bean value)

Examples

What follows is an example of UPDATE method with a parameter used in content provider too.

@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);

}

Attributes

  • path: define the segment path associated to DAO. Do not insert '/' at beginning of path, it's automatically added.
  • multiplicityResult: define numerosity of result of operation exposed by content provider.

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