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
3
votes
1 answer

Android CleanArchitecture Domain module and AutoValue

i want to use clean architecuture in a new app and so far it works great. I structured the app into 3 modules (presentation, data and domain) like in the following example: Android-CleanArchitecture There are some entities in my domain module. One…
BauerMitFackel
  • 372
  • 5
  • 15
3
votes
1 answer

AutoValue - public constructor possible

Is this possible? Or is the only solution the builder? Having a class with 10 fields would mean have to duplicate the 10 fields in the builder so that AutoValue works. Or via a manual written create function? Or am I missing something? I just want…
prom85
  • 16,896
  • 17
  • 122
  • 242
3
votes
1 answer

Android, Edit Auto Value parameter value

I'm using google Auto-value for my objects and also I used Builder class and create method to initialize my object, so how can I edit specific parameter of my object without initializing it again? @AutoValue public abstract class test implements…
Alireza Akbari
  • 2,153
  • 2
  • 28
  • 53
3
votes
2 answers

AutoValue not finding generated constructor in Android project

I am struggling to get AutoValue working in an Android project. It seems to be working for others, so I must just be missing something. I've tried enabling the jack compiler, that didn't seem to help. Here is a demo project that fails when I build…
user1978019
  • 3,008
  • 1
  • 29
  • 38
3
votes
1 answer

initialize properties with Retrofit and autovalue

I'm using Retrofit and AutoValue with the GSON extension. Everything works fine but I didn't find a way to initialize a property when the server does not return a value for it. I can add the annotation @Nullable to avoid the NPE but I'd like to be…
kingston
  • 11,053
  • 14
  • 62
  • 116
3
votes
1 answer

Android Studio Autovalue in java module and using in Android module

Using Android Studio I have an Android Module, and a Java module. In the Java module, I want to use AutoValue to generate immutable classes. All seems to work fine (files are generated in the Java module) but I'm unable to access those files in the…
Entreco
  • 12,738
  • 8
  • 75
  • 95
3
votes
1 answer

What is autovalue.shaded or what is a shaded jar?

I was looking for a way to parse a string to get an int out, and stumbled upon: NumberUtils.toInt("blah",99); I typed it into my IDE and it auto imported this for me: import autovalue.shaded.org.apache.commons.lang.math.NumberUtils; So I am…
Mendhak
  • 8,194
  • 5
  • 47
  • 64
2
votes
1 answer

Gson @AutoValue and Optional<> dont work together, is there a workaround?

Gson doesnt have direct support for serializing @AutoValue classes or for Optional<> fields, but com.ryanharter.auto.value adds @AutoValue and net.dongliu:gson-java8-datatype adds Optional<> and other java8 types. However, they dont work together…
John Caron
  • 1,367
  • 1
  • 10
  • 15
2
votes
0 answers

Jackson JSON deserializing wrapper objects

I am reading a REST-API, which returns a result in the following fashion { "total": 2, "results": [ { "name": "object-name", "id": 123 }, { "name": "another-object-name", "id": 321 } ] } In addition to…
Tom
  • 414
  • 4
  • 17
2
votes
1 answer

Using AutoValueSchema in Apache Beam PCollection gives `RuntimeException: Creator parameter arg0 Doesn't correspond to a schema field`

I am trying to have a PCollection of AutoValue-defined objects that I have created, and I've added the appropriate annotations to infer the Schema via DefaultSchema(AutoValueSchema.class). Like…
Pablo
  • 10,425
  • 1
  • 44
  • 67
2
votes
1 answer

How can I configure the moditect-maven-plugin to use the auto-value library in my modular application?

I'm trying to build a modular application, and I'm attempting to use the moditect-maven-plugin in order to use the auto-value library (which is not modular). Based on the instructions here, I came up with the following pom.xml:
gjvatsalya
  • 1,129
  • 13
  • 29
2
votes
1 answer

AndroidX, Autovalue support.annotations wrong depedency

I have an Android project which uses Autovalue to generate some of its models. I am attempting to move from the old com.android.support.* to the new androidx.* dependencies. I know that in the Android Gradle Plugin 3.2+ it attempts to replace all…
Shooky
  • 1,269
  • 8
  • 16
2
votes
1 answer

Why @AutoValue annotation uses the specific integer 1000003 for calculating hash code?

Java hash code generation code often uses prime numbers in its calculations. There are good reasons for this, as explained in Why use a prime number in hashCode? and elsewhere. For example, AutoValue will generate the following hash code for a…
ARK
  • 3,734
  • 3
  • 26
  • 29
2
votes
1 answer

Could not download auto-value.jar (com.google.auto.value:auto-value:1.5.2): No cached version available for offline mode

I have almost tried everything I know, but still as soon as I update my Android studio to the latest version it shows this error.What should I do? The gradle.build is: buildscript { repositories { google() jcenter() } …
Priya Pal
  • 21
  • 1
  • 3
2
votes
0 answers

Android AutoValue Inheritance

I'm having a hard time using the inheritance on AutoValue. I have an API which gives the details of a transaction. Some of the fields are present on all types of transactions, but the details are not. Details is specific for each type of…
Tenten Ponce
  • 2,436
  • 1
  • 13
  • 40