Comments (2)
You can use ColumnTypeAdapters that don't read or write anything to achieve this. Beyond that I have no plans to support ignoring fields.
from auto-value-cursor.
Hi @gabrielittner,
I am trying to to follow the approach you suggested, but I am having issues with the types.
I have implemented a generic ColumnTypeAdapter
:
public abstract class IgnoreColumnAdapter<T> implements ColumnTypeAdapter<T> {
public final T fromCursor(Cursor cursor, String columnName) {
return null;
}
public final void toContentValues(ContentValues values, String columnName, T value) {
}
}
Having this class:
public class User {
// Column needs to be ignored
public abstract UserCredentials userCredentials();
}
I have to create an specific class IgnoreUserCredentialsAdapter extends IgnoreColumnAdapter<UserCredentials>
to ensure the generated code in fromCursor()
has the expected type.
We have many types we would like to ignore. Is there a way to achieve this without creating an specific type for each of them?
Thanks a lot!
from auto-value-cursor.
Related Issues (20)
- auto-value-cursor 2.0.0-rc1 still does not support incremental build.
- auto-value-cursor 2.0.0 does not include shadow HOT 3
- Annotation to avoid a property being filled in ContentValues HOT 4
- Consider putNull support for foreign key ID values HOT 1
- Check for null in createFromCursor HOT 3
- Autogeneration of createFromCursor not occuring . HOT 6
- Improvement: reusable CursorAdapter class with different column name HOT 2
- Improvement: fillContentValues HOT 2
- @ColumnAdapter class can't be found at runtime HOT 2
- toContentValues is not generated HOT 3
- Default support for Optional without a custom type adapter HOT 2
- Improvement: Provide dependency in ColumnTypeAdapter
- Annotation @Nullable not handled correctly
- Special handling for autogenerated _id columns? HOT 4
- @AutoValue dependencies issue? HOT 1
- Improvement: Register global ColumnAdapters HOT 3
- Improvement: support ColumnTypeAdapters with identical names HOT 8
- set default value if a item in cursor is null HOT 1
- Improvement: Support to ignore fields
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from auto-value-cursor.