Closed nikiJava closed 6 years ago
Hi, @nikiJava ! You can write common resolver for all these cases. That will just throw exception if their methods will be called (actually they don't if you will not call put or get)
public class NoOpPutResolver<T> extends DefaultPutResolver<T> {
@Override
protected InsertQuery mapToInsertQuery(T object) {
throw new IllegalStateException("Put operation could not be called for object: " + object);
}
@Override
protected UpdateQuery mapToUpdateQuery(T object) {
throw new IllegalStateException("Put operation could not be called for object: " + object);
}
@Override
protected ContentValues mapToContentValues(T object) {
throw new IllegalStateException("Put operation could not be called for object: " + object);
}
}
Closing, feel free to comment or reopen ;) Btw nice issue number!
Cannot able to apply EventDetailModelStorIOContentResolverPutResolver() in putResolver
Hi! Can you show EventDetailModelStorIOContentResolverPutResolver definition? Does it extends resolver of the same library version (v3)?
import com.pushtorefresh.storio3.contentresolver.annotations.StorIOContentResolverColumn; import com.pushtorefresh.storio3.contentresolver.annotations.StorIOContentResolverType; import com.pushtorefresh.storio3.sqlite.annotations.StorIOSQLiteColumn; import com.pushtorefresh.storio3.sqlite.annotations.StorIOSQLiteType;
@StorIOSQLiteType(table = EventContract.Event.TABLE_NAME) @StorIOContentResolverType(uri = EventContract.Event.CONTENT_URI_STRING) public class EventDetailModel {
@StorIOSQLiteColumn(name = EventContract.Event.COLUMN_ID, key = true)
@StorIOContentResolverColumn(name = EventContract.Event.COLUMN_ID, key = true)
Integer id;
@StorIOSQLiteColumn(name = EventContract.Event.COLUMN_EVENT_ID)
@StorIOContentResolverColumn(name = EventContract.Event.COLUMN_EVENT_ID)
Integer event_id;
@StorIOSQLiteColumn(name = EventContract.Event.COLUMN_EVENT_NAME)
@StorIOContentResolverColumn(name = EventContract.Event.COLUMN_EVENT_NAME)
String eventName;
@StorIOSQLiteColumn(name = EventContract.Event.COLUMN_EVENT_CITY)
@StorIOContentResolverColumn(name = EventContract.Event.COLUMN_EVENT_CITY)
String eventCity;
@StorIOSQLiteColumn(name = EventContract.Event.COLUMN_EVENT_START_DATE)
@StorIOContentResolverColumn(name = EventContract.Event.COLUMN_EVENT_START_DATE)
String eventStartDate;
@StorIOSQLiteColumn(name = EventContract.Event.COLUMN_EVENT_END_DATE)
@StorIOContentResolverColumn(name = EventContract.Event.COLUMN_EVENT_END_DATE)
String eventEndDate;
@StorIOSQLiteColumn(name = EventContract.Event.COLUMN_EVENT_LAT)
@StorIOContentResolverColumn(name = EventContract.Event.COLUMN_EVENT_LAT)
double lat;
@StorIOSQLiteColumn(name = EventContract.Event.COLUMN_EVENT_LNG)
@StorIOContentResolverColumn(name = EventContract.Event.COLUMN_EVENT_LNG)
double lng;
@StorIOSQLiteColumn(name = EventContract.Event.COLUMN_EVENT_ADDRESS)
@StorIOContentResolverColumn(name = EventContract.Event.COLUMN_EVENT_ADDRESS)
String eventAddress;
@StorIOSQLiteColumn(name = EventContract.Event.COLUMN_EVENT_PINCODE)
@StorIOContentResolverColumn(name = EventContract.Event.COLUMN_EVENT_PINCODE)
String eventPincode;
@StorIOSQLiteColumn(name = EventContract.Event.COLUMN_EVENT_DISTANCE)
@StorIOContentResolverColumn(name = EventContract.Event.COLUMN_EVENT_DISTANCE)
String distance;
@StorIOSQLiteColumn(name = EventContract.Event.COLUMN_EVENT_BANNER)
@StorIOContentResolverColumn(name = EventContract.Event.COLUMN_EVENT_BANNER)
String eventBanner;
@StorIOSQLiteColumn(name = EventContract.Event.COLUMN_EVENT_AMOUNT)
@StorIOContentResolverColumn(name = EventContract.Event.COLUMN_EVENT_AMOUNT)
String eventAmount;
@StorIOSQLiteColumn(name = EventContract.Event.COLUMN_EVENT_ISFAV)
@StorIOContentResolverColumn(name = EventContract.Event.COLUMN_EVENT_ISFAV)
boolean isFav;
@StorIOSQLiteColumn(name = EventContract.Event.COLUMN_EVENT_ISADDEDTOCART)
@StorIOContentResolverColumn(name = EventContract.Event.COLUMN_EVENT_ISADDEDTOCART)
boolean addedTocart;
public EventDetailModel(){
}
public EventDetailModel(Integer id, Integer event_id, String eventName, String eventCity, String eventStartDate, String eventEndDate, double lat, double lng, String eventAddress, String eventPincode, String distance, String eventBanner, String eventAmount, boolean isFav, boolean addedTocart) {
this.id = id;
this.event_id = event_id;
this.eventName = eventName;
this.eventCity = eventCity;
this.eventStartDate = eventStartDate;
this.eventEndDate = eventEndDate;
this.lat = lat;
this.lng = lng;
this.eventAddress = eventAddress;
this.eventPincode = eventPincode;
this.distance = distance;
this.eventBanner = eventBanner;
this.eventAmount = eventAmount;
this.isFav = isFav;
this.addedTocart = addedTocart;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getEvent_id() {
return event_id;
}
public void setEvent_id(Integer event_id) {
this.event_id = event_id;
}
public String getEventName() {
return eventName;
}
public void setEventName(String eventName) {
this.eventName = eventName;
}
public String getEventCity() {
return eventCity;
}
public void setEventCity(String eventCity) {
this.eventCity = eventCity;
}
public String getEventStartDate() {
return eventStartDate;
}
public void setEventStartDate(String eventStartDate) {
this.eventStartDate = eventStartDate;
}
public String getEventEndDate() {
return eventEndDate;
}
public void setEventEndDate(String eventEndDate) {
this.eventEndDate = eventEndDate;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
public double getLng() {
return lng;
}
public void setLng(double lng) {
this.lng = lng;
}
public String getEventAddress() {
return eventAddress;
}
public void setEventAddress(String eventAddress) {
this.eventAddress = eventAddress;
}
public String getEventPincode() {
return eventPincode;
}
public void setEventPincode(String eventPincode) {
this.eventPincode = eventPincode;
}
public String getDistance() {
return distance;
}
public void setDistance(String distance) {
this.distance = distance;
}
public String getEventBanner() {
return eventBanner;
}
public void setEventBanner(String eventBanner) {
this.eventBanner = eventBanner;
}
public String getEventAmount() {
return eventAmount;
}
public void setEventAmount(String eventAmount) {
this.eventAmount = eventAmount;
}
public boolean isFav() {
return isFav;
}
public void setFav(boolean fav) {
isFav = fav;
}
public boolean isAddedTocart() {
return addedTocart;
}
public void setAddedTocart(boolean addedTocart) {
this.addedTocart = addedTocart;
}
}
Gradle Plugin: implementation 'com.pushtorefresh.storio3:content-resolver:3.0.0'
implementation 'com.pushtorefresh.storio3:content-resolver-annotations:3.0.0'
annotationProcessor 'com.pushtorefresh.storio3:content-resolver-annotations-processor:3.0.0'
implementation 'com.pushtorefresh.storio3:sqlite-annotations:3.0.0'
annotationProcessor 'com.pushtorefresh.storio3:sqlite-annotations-processor:3.0.0'
You should specify type of resolver:
ContentResolverMapping.<EventDetailModel>builder()
It seems this question is unrelated to topic. Please create new issue next time ;)
@nikitin-da thanks it's worked now . :) yeah sure
Hello, guys!
Is there any way to not create PutResolver and GetResolver for my model? I'm not going to use Put/Update and Get operations, only Delete operation, bun when I create DefaultStorIOContentResolver and add type mapping for my model I have to specify PutResolver, then GetResolver and afterwards DeleteResolver. How can I specify DeleteResolver only?