This repository has been archived by the owner on Jul 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Annotation to avoid a property being filled in ContentValues #25
Comments
Currently there isn't a way, but you can add and implement a second @AutoValue public abstract class User {
abstract String id();
abstract String name();
abstract String email();
// you can choose whichever name you want for the method
abstract ContentValues toCompleteContentValues();
public ContentValues toContentValues() {
return toCompleteContentValues().remove("id");
}
} |
Thanks for the info! Do you plan to add something to resolve this? |
You can use the new public final class IgnoreFieldAdapter {
public static ContentValues ignoreField(String s) {
return null;
}
} @AutoValue public abstract class User {
@ValuesAdapter(IgnoreFieldAdapter.class) abstract String id();
abstract String name();
abstract String email();
abstract ContentValues toValues();
} |
I'm wondering since ValuesAdapter is no longer a thing, how is this supposed to work with a ColumnTypeAdapter? |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Is there any annotation or something to add to a property in order for it to be left out when building toContentValues?
I would need this for the Ids that are autoincremented primary keys.
Thanks!
The text was updated successfully, but these errors were encountered: