Fixed
Status Update
Comments
be...@google.com <be...@google.com> #2
mm...@commonsware.com <mm...@commonsware.com> #3
> We accept pull requests! :)
Is there a public repo somewhere? I don't see any obvious repo for it inhttps://android.googlesource.com , and it doesn't seem to be inside https://android.googlesource.com/platform/frameworks/support .
Room supports final fields (yay!), which probably will suffice for many people with respect to this feature request.
Is there a public repo somewhere? I don't see any obvious repo for it in
Room supports final fields (yay!), which probably will suffice for many people with respect to this feature request.
yb...@google.com <yb...@google.com> #4
Room supports immutability (it can use arg constructors) but does not directly support AutoValue. It is in the schedule but not high priority :/. Idk much about its internals at this stage so I'm not sure how we would implement it but should be totally doable.
Sorry we don't have the source release yet :/.
Sorry we don't have the source release yet :/.
mm...@commonsware.com <mm...@commonsware.com> #5
"It is in the schedule but not high priority" -- completely understandable.
"Sorry we don't have the source release yet :/." -- ah, OK, I thought perhaps with the pull request comment, that meant that there was a repo somewhere that I had overlooked.
Thanks!
"Sorry we don't have the source release yet :/." -- ah, OK, I thought perhaps with the pull request comment, that meant that there was a repo somewhere that I had overlooked.
Thanks!
yb...@google.com <yb...@google.com>
te...@gmail.com <te...@gmail.com> #6
Add autovalue support also means you can easily achieve parcelable by https://github.com/rharter/auto-value-parcel . Please consider support this.
ch...@gmail.com <ch...@gmail.com> #7
AutoValue is really a handy way to ensure data integrity.
jf...@gmail.com <jf...@gmail.com> #8
Please add AutoValue support. AutoValue is a Google library with really good benefits such as toString() , hashCode() , AutoValue.Builder , checks at creation time if @NonNull values are null, etc.
mm...@commonsware.com <mm...@commonsware.com> #9
FWIW, issue 64206877 is not publicly accessible.
ry...@gmail.com <ry...@gmail.com> #10
@Yigit: That appears to be a private ticket. Any way we can have access to keep up with it?
se...@google.com <se...@google.com>
ol...@gmail.com <ol...@gmail.com> #11
Have any updates?
rm...@gmail.com <rm...@gmail.com> #12
news?
to...@gmail.com <to...@gmail.com> #13
Is there any update? This is huge for app that absolutely enforces immutable entities.
ra...@gmail.com <ra...@gmail.com> #14
SqlDelight has out of the box support for AutoValue. Use it with SqlBrite and you've got *pretty good* parity with Room. With the lack of movement on this ticket, I'd suggest at least taking a look at those if AutoValue is important to you.
fh...@gmail.com <fh...@gmail.com> #15
Support on olways
yb...@google.com <yb...@google.com> #16
Sorry this used to be higher priority but other features got in the way (and to be honest, androidX migration took a lot more time than we thought).
I want to make 1 thing clear though, Room does support immutable entities. One of the reasons why this ticket lost some priority is that it is specific to AutoValue, not immutability. If you are using Kotlin, data classes give you the same power and Room supports them properly. (hence, there is an easy way to achieve immutability w/ Room).
The issue in this one is that we don't have out of the box support to discover AutoValue builders.
We still plan to do this, sorry that it is taking longer than we initially communicated.
I want to make 1 thing clear though, Room does support immutable entities. One of the reasons why this ticket lost some priority is that it is specific to AutoValue, not immutability. If you are using Kotlin, data classes give you the same power and Room supports them properly. (hence, there is an easy way to achieve immutability w/ Room).
The issue in this one is that we don't have out of the box support to discover AutoValue builders.
We still plan to do this, sorry that it is taking longer than we initially communicated.
em...@gmail.com <em...@gmail.com> #17
I'd like to piggy back onto this issue, because I've fun into a similar problem with immutability that does NOT involve autovalue. What I have found is either a bug or a missing feature, depending on your perspective.
Let's say I have a Kotlin data class with only `val` properties. I want to serialize this into my Room database, but I want to decorate it with a few other values, for example a timestamp so I know when it was last updated, and a userId because my database supports multiple users. Oh look! There's an annotation `@Embedded` that seems to do just want I want. I can create a new class specific to Room persistence, add the few new properties I want, and then "embed" the original object, and damn that was easy.
Oh no. Now my project won't compile. It seems that embedded objects must have public getters -- all my `val`s must now be `var`s. D:
Sigh. I guess I'll just write a new class that has _all_ the properties of the original, plus a few more, and write an extension function to transform from one to the other. Really glad Room saved me all that Sqlite boilerplate, so I now have time for Room-specific boilerplate ;-)
Let's say I have a Kotlin data class with only `val` properties. I want to serialize this into my Room database, but I want to decorate it with a few other values, for example a timestamp so I know when it was last updated, and a userId because my database supports multiple users. Oh look! There's an annotation `@Embedded` that seems to do just want I want. I can create a new class specific to Room persistence, add the few new properties I want, and then "embed" the original object, and damn that was easy.
Oh no. Now my project won't compile. It seems that embedded objects must have public getters -- all my `val`s must now be `var`s. D:
Sigh. I guess I'll just write a new class that has _all_ the properties of the original, plus a few more, and write an extension function to transform from one to the other. Really glad Room saved me all that Sqlite boilerplate, so I now have time for Room-specific boilerplate ;-)
em...@gmail.com <em...@gmail.com> #18
*public setters, not public getters
yb...@google.com <yb...@google.com> #19
#17 seems like a bug, we are supposed to handle Embedded fields in constructor parameters.
Can you file a bug with a sample project ?
We do have a test for having embedded as a constructor parameter, so maybe something else is wrong.
from one of our tests:
@Entity(tableName = "fc")
static class FullConstructor {
@PrimaryKey
public final int a;
public final int b;
@Embedded
public final MyEmbedded embedded;
FullConstructor(int a, int b, MyEmbedded embedded) {
this.a = a;
this.b = b;
this.embedded = embedded;
}
}
Can you file a bug with a sample project ?
We do have a test for having embedded as a constructor parameter, so maybe something else is wrong.
from one of our tests:
@Entity(tableName = "fc")
static class FullConstructor {
@PrimaryKey
public final int a;
public final int b;
@Embedded
public final MyEmbedded embedded;
FullConstructor(int a, int b, MyEmbedded embedded) {
this.a = a;
this.b = b;
this.embedded = embedded;
}
}
em...@gmail.com <em...@gmail.com> #20
Sure, I'd be happy to put up a sample project. I'll try to pull something together later today or maybe tomorrow.
em...@gmail.com <em...@gmail.com> #21
Well, I tried. Either I did something wrong the first time, or... I did something wrong the first time :shrug-emoji: Tried reproducing in a sample project, couldn't. Mystified, I tried again in my much more complex work project -- couldn't. So, I guess that's a good thing!
yb...@google.com <yb...@google.com>
ab...@gmail.com <ab...@gmail.com> #22
if added this feature will be good!
ap...@google.com <ap...@google.com> #23
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 8c2d348127161daaf624f77d80cb662e65e3af2a
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Fri Jul 13 15:18:42 2018
Add support for using AutoValue classes as Pojos and Entities.
Support using AutoValue generated classes as Pojos by processing the
AutoValue_* generated class that contains fields and getter
implementations.
To support the AutoValue api @PrimaryKey and @ColumnInfo have been
opened up to target methods. However, since we only want to allow their
usage in methods to support AutoValue a new processing step was added
that throws an error if it finds a method not implement by AutoValue
with any of these two annotations.
Note that Embedded and Relations are not yet supported.
Bug: 62408420
Test: ./gradlew :room:room-compiler:test \
:room:integration-tests:testapp:cC \
:room:integration-tests:autovaluetestapp:cC
Change-Id: I782d6ec074776f7af7cae977848443f3311b1d87
M app-toolkit/settings.gradle
M buildSrc/src/main/kotlin/androidx/build/dependencies/Dependencies.kt
M room/common/src/main/java/androidx/room/ColumnInfo.java
M room/common/src/main/java/androidx/room/PrimaryKey.java
M room/compiler/build.gradle
M room/compiler/src/main/kotlin/androidx/room/RoomProcessor.kt
A room/compiler/src/main/kotlin/androidx/room/checker/AutoValueTargetChecker.kt
M room/compiler/src/main/kotlin/androidx/room/ext/element_ext.kt
M room/compiler/src/main/kotlin/androidx/room/processor/EntityProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/PojoProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
M room/compiler/src/main/kotlin/androidx/room/processor/RawQueryMethodProcessor.kt
A room/compiler/src/main/kotlin/androidx/room/processor/autovalue/AutoValuePojoProcessorDelegate.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/vo/Constructor.kt
M room/compiler/src/main/kotlin/androidx/room/vo/Warning.kt
M room/compiler/src/main/kotlin/androidx/room/writer/FieldReadWriteWriter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/EntityProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/processor/PojoProcessorTest.kt
A room/compiler/src/test/kotlin/androidx/room/processor/autovalue/AutoValuePojoProcessorDelegateTest.kt
A room/compiler/src/test/kotlin/androidx/room/processor/checker/AutoValueTargetCheckerTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/test_util.kt
A room/integration-tests/autovaluetestapp/.gitignore
A room/integration-tests/autovaluetestapp/build.gradle
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/TestDatabase.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/ParcelableEntityDao.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/PersonDao.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/PetDao.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/ParcelableEntityDaoTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/PersonDaoTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/PetDaoTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/TestDatabaseTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/EmbeddedAutoValue.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/ParcelableEntity.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/Person.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/Pet.java
A room/integration-tests/autovaluetestapp/src/main/AndroidManifest.xml
M settings.gradle
https://android-review.googlesource.com/720548
https://goto.google.com/android-sha1/8c2d348127161daaf624f77d80cb662e65e3af2a
Branch: androidx-master-dev
commit 8c2d348127161daaf624f77d80cb662e65e3af2a
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Fri Jul 13 15:18:42 2018
Add support for using AutoValue classes as Pojos and Entities.
Support using AutoValue generated classes as Pojos by processing the
AutoValue_* generated class that contains fields and getter
implementations.
To support the AutoValue api @PrimaryKey and @ColumnInfo have been
opened up to target methods. However, since we only want to allow their
usage in methods to support AutoValue a new processing step was added
that throws an error if it finds a method not implement by AutoValue
with any of these two annotations.
Note that Embedded and Relations are not yet supported.
Bug: 62408420
Test: ./gradlew :room:room-compiler:test \
:room:integration-tests:testapp:cC \
:room:integration-tests:autovaluetestapp:cC
Change-Id: I782d6ec074776f7af7cae977848443f3311b1d87
M app-toolkit/settings.gradle
M buildSrc/src/main/kotlin/androidx/build/dependencies/Dependencies.kt
M room/common/src/main/java/androidx/room/ColumnInfo.java
M room/common/src/main/java/androidx/room/PrimaryKey.java
M room/compiler/build.gradle
M room/compiler/src/main/kotlin/androidx/room/RoomProcessor.kt
A room/compiler/src/main/kotlin/androidx/room/checker/AutoValueTargetChecker.kt
M room/compiler/src/main/kotlin/androidx/room/ext/element_ext.kt
M room/compiler/src/main/kotlin/androidx/room/processor/EntityProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/PojoProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
M room/compiler/src/main/kotlin/androidx/room/processor/RawQueryMethodProcessor.kt
A room/compiler/src/main/kotlin/androidx/room/processor/autovalue/AutoValuePojoProcessorDelegate.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/vo/Constructor.kt
M room/compiler/src/main/kotlin/androidx/room/vo/Warning.kt
M room/compiler/src/main/kotlin/androidx/room/writer/FieldReadWriteWriter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/EntityProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/processor/PojoProcessorTest.kt
A room/compiler/src/test/kotlin/androidx/room/processor/autovalue/AutoValuePojoProcessorDelegateTest.kt
A room/compiler/src/test/kotlin/androidx/room/processor/checker/AutoValueTargetCheckerTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/test_util.kt
A room/integration-tests/autovaluetestapp/.gitignore
A room/integration-tests/autovaluetestapp/build.gradle
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/TestDatabase.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/ParcelableEntityDao.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/PersonDao.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/PetDao.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/ParcelableEntityDaoTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/PersonDaoTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/PetDaoTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/TestDatabaseTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/EmbeddedAutoValue.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/ParcelableEntity.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/Person.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/Pet.java
A room/integration-tests/autovaluetestapp/src/main/AndroidManifest.xml
M settings.gradle
ap...@google.com <ap...@google.com> #24
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 038e674add5afddbb34371b9c1fda6885efbd7be
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Fri Jul 13 15:18:42 2018
Add support for using AutoValue classes as Pojos and Entities.
Support using AutoValue generated classes as Pojos by processing the
AutoValue_* generated class that contains fields and getter
implementations.
To support the AutoValue api @PrimaryKey and @ColumnInfo have been
opened up to target methods. However, since we only want to allow their
usage in methods to support AutoValue a new processing step was added
that throws an error if it finds a method not implement by AutoValue
with any of these two annotations.
Note that Embedded and Relations are not yet supported.
Bug: 62408420
Test: ./gradlew :room:room-compiler:test \
:room:integration-tests:testapp:cC \
:room:integration-tests:autovaluetestapp:cC
Change-Id: Idce0b5934e0aa864117fc95e7d19a7edc2c94f9f
M app-toolkit/settings.gradle
M buildSrc/src/main/kotlin/androidx/build/dependencies/Dependencies.kt
M room/common/src/main/java/androidx/room/ColumnInfo.java
M room/common/src/main/java/androidx/room/PrimaryKey.java
M room/compiler/build.gradle
M room/compiler/src/main/kotlin/androidx/room/RoomProcessor.kt
A room/compiler/src/main/kotlin/androidx/room/checker/AutoValueTargetChecker.kt
M room/compiler/src/main/kotlin/androidx/room/ext/element_ext.kt
M room/compiler/src/main/kotlin/androidx/room/processor/EntityProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/PojoProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
M room/compiler/src/main/kotlin/androidx/room/processor/RawQueryMethodProcessor.kt
A room/compiler/src/main/kotlin/androidx/room/processor/autovalue/AutoValuePojoProcessorDelegate.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/vo/Constructor.kt
M room/compiler/src/main/kotlin/androidx/room/vo/Warning.kt
M room/compiler/src/main/kotlin/androidx/room/writer/FieldReadWriteWriter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/EntityProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/processor/PojoProcessorTest.kt
A room/compiler/src/test/kotlin/androidx/room/processor/autovalue/AutoValuePojoProcessorDelegateTest.kt
A room/compiler/src/test/kotlin/androidx/room/processor/checker/AutoValueTargetCheckerTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/test_util.kt
A room/integration-tests/autovaluetestapp/.gitignore
A room/integration-tests/autovaluetestapp/build.gradle
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/TestDatabase.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/ParcelableEntityDao.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/PersonDao.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/PetDao.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/ParcelableEntityDaoTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/PersonDaoTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/PetDaoTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/TestDatabaseTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/EmbeddedAutoValue.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/ParcelableEntity.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/Person.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/Pet.java
A room/integration-tests/autovaluetestapp/src/main/AndroidManifest.xml
M settings.gradle
https://android-review.googlesource.com/720788
https://goto.google.com/android-sha1/038e674add5afddbb34371b9c1fda6885efbd7be
Branch: androidx-master-dev
commit 038e674add5afddbb34371b9c1fda6885efbd7be
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Fri Jul 13 15:18:42 2018
Add support for using AutoValue classes as Pojos and Entities.
Support using AutoValue generated classes as Pojos by processing the
AutoValue_* generated class that contains fields and getter
implementations.
To support the AutoValue api @PrimaryKey and @ColumnInfo have been
opened up to target methods. However, since we only want to allow their
usage in methods to support AutoValue a new processing step was added
that throws an error if it finds a method not implement by AutoValue
with any of these two annotations.
Note that Embedded and Relations are not yet supported.
Bug: 62408420
Test: ./gradlew :room:room-compiler:test \
:room:integration-tests:testapp:cC \
:room:integration-tests:autovaluetestapp:cC
Change-Id: Idce0b5934e0aa864117fc95e7d19a7edc2c94f9f
M app-toolkit/settings.gradle
M buildSrc/src/main/kotlin/androidx/build/dependencies/Dependencies.kt
M room/common/src/main/java/androidx/room/ColumnInfo.java
M room/common/src/main/java/androidx/room/PrimaryKey.java
M room/compiler/build.gradle
M room/compiler/src/main/kotlin/androidx/room/RoomProcessor.kt
A room/compiler/src/main/kotlin/androidx/room/checker/AutoValueTargetChecker.kt
M room/compiler/src/main/kotlin/androidx/room/ext/element_ext.kt
M room/compiler/src/main/kotlin/androidx/room/processor/EntityProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/PojoProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
M room/compiler/src/main/kotlin/androidx/room/processor/RawQueryMethodProcessor.kt
A room/compiler/src/main/kotlin/androidx/room/processor/autovalue/AutoValuePojoProcessorDelegate.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/vo/Constructor.kt
M room/compiler/src/main/kotlin/androidx/room/vo/Warning.kt
M room/compiler/src/main/kotlin/androidx/room/writer/FieldReadWriteWriter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/EntityProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/processor/PojoProcessorTest.kt
A room/compiler/src/test/kotlin/androidx/room/processor/autovalue/AutoValuePojoProcessorDelegateTest.kt
A room/compiler/src/test/kotlin/androidx/room/processor/checker/AutoValueTargetCheckerTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/test_util.kt
A room/integration-tests/autovaluetestapp/.gitignore
A room/integration-tests/autovaluetestapp/build.gradle
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/TestDatabase.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/ParcelableEntityDao.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/PersonDao.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/PetDao.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/ParcelableEntityDaoTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/PersonDaoTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/PetDaoTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/TestDatabaseTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/EmbeddedAutoValue.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/ParcelableEntity.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/Person.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/Pet.java
A room/integration-tests/autovaluetestapp/src/main/AndroidManifest.xml
M settings.gradle
ap...@google.com <ap...@google.com> #25
Project: platform/frameworks/support
Branch: androidx-master-dev
commit b4e0fe5d54a89ce8ce9a852774892c498edd4508
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Mon Jul 23 19:51:46 2018
Add support for @Embedded in AutoValue Pojos.
Bug: 62408420
Test: ./gradlew :room:integration-tests:autovaluetestapp:cC
Change-Id: I4aa02aae022e4971a8708c4aba4cf9f3e90f65a5
M room/common/src/main/java/androidx/room/Embedded.java
M room/compiler/src/main/kotlin/androidx/room/checker/AutoValueTargetChecker.kt
M room/compiler/src/test/kotlin/androidx/room/processor/checker/AutoValueTargetCheckerTest.kt
M room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/PersonDao.java
M room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/PetDao.java
M room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/PersonDaoTest.java
M room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/PetDaoTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/PersonAndCat.java
M room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/Pet.java
https://android-review.googlesource.com/720896
https://goto.google.com/android-sha1/b4e0fe5d54a89ce8ce9a852774892c498edd4508
Branch: androidx-master-dev
commit b4e0fe5d54a89ce8ce9a852774892c498edd4508
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Mon Jul 23 19:51:46 2018
Add support for @Embedded in AutoValue Pojos.
Bug: 62408420
Test: ./gradlew :room:integration-tests:autovaluetestapp:cC
Change-Id: I4aa02aae022e4971a8708c4aba4cf9f3e90f65a5
M room/common/src/main/java/androidx/room/Embedded.java
M room/compiler/src/main/kotlin/androidx/room/checker/AutoValueTargetChecker.kt
M room/compiler/src/test/kotlin/androidx/room/processor/checker/AutoValueTargetCheckerTest.kt
M room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/PersonDao.java
M room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/PetDao.java
M room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/PersonDaoTest.java
M room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/PetDaoTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/PersonAndCat.java
M room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/Pet.java
ap...@google.com <ap...@google.com> #26
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 0f55cbbe13e26294af67aca6bce0e13a960ae752
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Mon Jul 30 17:06:22 2018
Add support for @Relation in AutoValue Pojos.
Bug: 62408420
Test: ./gradlew :room:integration-tests:autovaluetestapp:cC
Change-Id: I7634ac388e328dca9c33f7ac422080b42b362ee0
M room/common/src/main/java/androidx/room/Relation.java
M room/compiler/src/main/kotlin/androidx/room/checker/AutoValueTargetChecker.kt
M room/compiler/src/test/kotlin/androidx/room/processor/checker/AutoValueTargetCheckerTest.kt
M room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/PersonDao.java
M room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/PetDao.java
M room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/PersonDaoTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/PersonWithCats.java
https://android-review.googlesource.com/723664
https://goto.google.com/android-sha1/0f55cbbe13e26294af67aca6bce0e13a960ae752
Branch: androidx-master-dev
commit 0f55cbbe13e26294af67aca6bce0e13a960ae752
Author: Daniel Santiago Rivera <danysantiago@google.com>
Date: Mon Jul 30 17:06:22 2018
Add support for @Relation in AutoValue Pojos.
Bug: 62408420
Test: ./gradlew :room:integration-tests:autovaluetestapp:cC
Change-Id: I7634ac388e328dca9c33f7ac422080b42b362ee0
M room/common/src/main/java/androidx/room/Relation.java
M room/compiler/src/main/kotlin/androidx/room/checker/AutoValueTargetChecker.kt
M room/compiler/src/test/kotlin/androidx/room/processor/checker/AutoValueTargetCheckerTest.kt
M room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/PersonDao.java
M room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/dao/PetDao.java
M room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/test/PersonDaoTest.java
A room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/PersonWithCats.java
[Deleted User] <[Deleted User]> #28
Does this means it could be used only with AutoValue, and not with other code generators like Immutables https://immutables.github.io/ ?
In that case it's really limited.
Can you provide way to have static factory methods instead of constructors? Then we can use whatever code generator.
Like:
@RoomFactoryMethod
public static MyEntity create(int id, String name) {
return ImmutableMyEntity.of(id, name);
}
In that case it's really limited.
Can you provide way to have static factory methods instead of constructors? Then we can use whatever code generator.
Like:
@RoomFactoryMethod
public static MyEntity create(int id, String name) {
return ImmutableMyEntity.of(id, name);
}
yb...@google.com <yb...@google.com> #29
Yes, this is specific to AutoValue (we also support regular java immutables and kotlin) as this solves the problem w/o any extra code on the developer side.
Having an entity factory method seems reasonable too as a future improvement.
Having an entity factory method seems reasonable too as a future improvement.
ub...@gmail.com <ub...@gmail.com> #30
Would it be possible to support the AutoValue Builder pattern? Currently the only supported pattern appears to require a create() method.
da...@google.com <da...@google.com> #31
Your AutoValue class can have an @AutoValue.Builder along side with a create() method as shown here: https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/Person.java . If you are asking for Room to solely support the Builder pattern without any create() method then please file a separate issue since that is not currently available.
Description
Version used: 1.0.0-alpha2
Devices/Android versions reproduced on: n/a
Immutability is gaining popularity. AutoValue is a popular way of implementing immutability in Java. However, Room seems field-centric, and with AutoValue, the fields are code-generated. For example, @PrimaryKey does not work when applied to a getter method for an @AutoValue class. Ideally, there would be a way for Room and AutoValue to work together. That might be as simple as allowing @PrimaryKey and similar annotations to be placed on the getter instead of on the field. OTOH, since AutoValue itself is a code-generator, I can imagine that getting it to co-exist with Room could be... interesting.
Just a thought. Thanks for considering it!