Questions tagged [auto-value]

Immutable value type code generation for Java 1.6+.

AutoValue, a part of Google's open source auto project, makes creating immutable value type classes in Java easy.

Documentation can be found here.

118 questions
15
votes
2 answers

How do I subclass an AutoValue class?

I'm using an AutoValue extension to generate my Parcelable Android classes. The documentation specifically states that one @AutoValue cannot extend another: https://github.com/google/auto/blob/master/value/userguide/howto.md#inherit Another…
jwBurnside
  • 849
  • 4
  • 31
  • 66
14
votes
2 answers

Using @AutoValue with nested classes gives a "cannot find symbol" error

When trying to use @AutoValue with nested classes: public class Nested { @AutoValue public static abstract class Example { public static Example create(String name, int integer) { return new AutoValue_Example(name, integer); } …
Amitha Perera
  • 143
  • 1
  • 4
13
votes
4 answers

Cannot resolve symbol with AutoValue and IntelliJ

I have been trying to find the correct settings for IntelliJ's annotation processing in order for it to co-exist with Gradle's build process. Whenever I build from IntelliJ I cannot get it to recognise the generated sources from the…
13
votes
5 answers

Android Room Persistence library entity with AutoValue

Is it possible to use both Room persistence library's @Entity with AutoValue's @AutoValue and builder on the same POJO? How should i do it?
Weizhi
  • 1,027
  • 8
  • 22
12
votes
4 answers

Kapt does not work with AutoValue in Android Studio 3.0

Gradle dependencies: compile 'com.google.dagger:dagger:2.9' annotationProcessor 'com.google.dagger:dagger-compiler:2.9' kapt 'com.google.dagger:dagger-compiler:2.9' provided "com.google.auto.value:auto-value:1.4.1" annotationProcessor…
ar-g
  • 3,417
  • 2
  • 28
  • 39
12
votes
2 answers

How to use AutoValue with Retrofit 2?

I've got AutoValue (and the android-apt plugin) working in a project, and I'm aware of Ryan Harter's gson extension for AutoValue, but how do I hook Retrofit 2 up to use the extension and factory method on the abstract class? String grantType =…
Ollie C
  • 28,313
  • 34
  • 134
  • 217
10
votes
4 answers

Android Studio can not resolve AutoValue class

I started to use AutoValue today in one of my projects and what bothers me is that Android Studio can not resolve the generated class name (AutoValue_DrawableContent) and marks it with the red color: How I can suppress this warning?
aga
  • 27,954
  • 13
  • 86
  • 121
10
votes
2 answers

Is it possible to add a value to a collection in Java AutoValue?

I have a Java AutoValue class with a List attribute. I'd like to allow the builder to append to the List rather than having to pass the entire constructed list. Example: import com.google.auto.value.AutoValue; @AutoValue public abstract class Deck…
user3170530
  • 416
  • 3
  • 13
9
votes
1 answer

How to copy/transform an AutoValue object with builder

I'm playing auto-value with builder recently. And I'm in such a situation, say I have to transform an existing object to a new one with a few properties get updated. The example code is here: @AutoValue public abstract class SomeObject { public…
xinthink
  • 1,460
  • 1
  • 18
  • 22
9
votes
1 answer

Proguard with Autovalue

I have just started using AutoValue but I am unable to make it work with proguard. I have around 6000+ warnings that look like this Warning:autovalue.shaded.com.google.common.auto.common.MoreElements$1: can't find superclass or interface…
jiduvah
  • 5,108
  • 6
  • 39
  • 55
8
votes
2 answers

Maven project build fails in IntelliJ when annotation processors are used (google/auto-value)

I use google/auto-value to create immutable value classes in a maven project.
sn42
  • 2,353
  • 1
  • 15
  • 27
8
votes
2 answers

Can auto-value-parcel-adapter cope with Typed Set of another auto-value Class?

I am investigating auto-value and its extensions, namely auto-value-parcel and auto-value-parcel-adapter within my Android application. I have these model classes:- @AutoValue public abstract class Xenarchaeota implements Parcelable { …
Hector
  • 4,016
  • 21
  • 112
  • 211
7
votes
0 answers

Jackson + Autovalue Builder bean validation

I have a the following Event DTO class: @AutoValue @JsonDeserialize(builder = AutoValue_Event.Builder.class) @JsonIgnoreProperties(ignoreUnknown = true) public abstract class Event { public static Event.Builder builder() { return new…
louis amoros
  • 2,418
  • 3
  • 19
  • 40
6
votes
2 answers

Unable to deserialize alternate name with GSON, AutoValue, and Retrofit 2

I am using retrofit version 2.1.0 to deserialize JSON into pojos. A field in the pojo can be received under different names in the json. To deserialize the field correctly, I used the @serializedName annotation in the following…
6
votes
2 answers

How to use auto-value with firebase 9.2 in Android

I want to use auto-value with firebase 9.2.0+. I have the following code: @AutoValue public abstract class Office { public static Builder builder() { return new AutoValue_Office.Builder(); } public abstract double latitud(); …
epool
  • 6,710
  • 7
  • 38
  • 43
1
2 3 4 5 6 7 8