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
1
vote
1 answer

Jersey ignores ExceptionMapper

I made an ExceptionMapper to catch and log all exceptions, like: @Provider public class CatchAllExceptionsMapper implements ExceptionMapper { private static final Logger LOG = LoggerFactory.getLogger(CatchAllExceptionsMapper.class); …
Michel Feinstein
  • 13,416
  • 16
  • 91
  • 173
1
vote
1 answer

Google AutoValue does not recognise AutoValue_CustomType

I am trying to use Google AutoValue to generate HomeKey in my Android Studio project, but it does not recignose AutoValue_HomeKey() (see in the commented code below). The used gradle version: 4.10.1 My Android project is based on this example…
1
vote
1 answer

How can I use auto-value-gson to map unknown json fields

I am making a simple github gist view app in android that talks with their api. But I am unsure how I can use AutoValue and GSON to map this json response. Do note that I have removed alot of keys since I dont need it currently, the actual response…
Niclas
  • 510
  • 6
  • 19
1
vote
1 answer

Cannot find symbol class AutoValueGson_AutoValueGsonFactory

I hope you can help me, I'm trying to implement autovalue in my android project, but the code is not been generated. I added in app/build.gradle: provided 'com.google.auto.value:auto-value:1.5.3' annotationProcessor…
Kevin Ramirez Zavalza
  • 1,629
  • 1
  • 22
  • 34
1
vote
1 answer

Gradle plugin confusion/conflict with AutoValue and FreeBuilder

I am experimenting with Gradle/IntelliJ and various Java builders/containers. However, I am unable to configure both org.inferred.FreeBuilder and com.google.auto.value.AutoValue in the same project. With the build.gradle file below, I am able to…
Leon
  • 1,141
  • 13
  • 25
1
vote
1 answer

Create custom Nullable annotation

I'd like to create an annotation which effectively acts exactly as javax.annotation.Nullable. The reason I need this is that I just need a different name for it in my context. The problem is that I have a field that has to acts as Nullable for the…
wesleyy
  • 2,575
  • 9
  • 34
  • 54
1
vote
1 answer

Why might changing a field from int to Integer cause objects to disappear from Sets?

There's a presentation on AutoValue (a terse way to define immutable objects in Java, with sensible defaults for equals, hashCode, etc.):…
Vanessa Phipps
  • 2,205
  • 1
  • 18
  • 22
1
vote
1 answer

Avoid boilerplate code for POJOs representing JSONs

I am creating a library of lots of different NetworkMessages that are normally in a JSON format, and now a corresponding Java model is needed. The thing about it is that those messages can easily have about 100 fields in a JSON. Some of them are…
wesleyy
  • 2,575
  • 9
  • 34
  • 54
1
vote
0 answers

Cannot resolve symbol generated AutoValue_Foo class inside pure java module in android project

I am trying to use AutoValue in a module that is written in pure Java that acts the domain module for my Android application. My application is composed of 3 layers, presentation, domain and data. Presentation and Data both have android…
Sean Blahovici
  • 5,350
  • 4
  • 28
  • 38
1
vote
1 answer

AutoValue how to call super

@AutoValue public abstract class MyError extends Throwable { public static MyError create( Throwable ex, MyErrorCode errorCode) { return new AutoValue_MyError(ex, errorCode); } public abstract Throwable…
codereviewanskquestions
  • 13,460
  • 29
  • 98
  • 167
1
vote
0 answers

What is a good way to use AutoValue and hibernate together

I want my hibernate DAO's to return auto value classes I can extend AbstractDao for the same, but is there a better way?
Aashrai Ravooru
  • 131
  • 2
  • 6
1
vote
4 answers

Inheritance with Retrofit failed to invoke, with no args

I have this base abstract class that looks like this. public abstract class Species implements Parcelable { public Species() { } public abstract String name(); } And then my Human class looks like this. @AutoValue public abstract…
Claud
  • 1,065
  • 3
  • 26
  • 38
1
vote
1 answer

Auto-value-gson with an interface error, register an InstanceCreator?

I have an interface class that looks like this. public interface Species { String name(); } And a Human class that implements @AutoValue with a TypeAdapter. @AutoValue public abstract class Human implements Parcelable, Species { public…
Claud
  • 1,065
  • 3
  • 26
  • 38
1
vote
0 answers

Columns for Value Objects in entities are not created on start-up

I'm using Spring Boot with Spring Data and H2 in-memory db and wanted to try using Value Objects instead of Strings everywhere and I found this neat library: AutoValue to create Value Objects. So here is my entity: @Entity @Access(AccessType.FIELD)…
doublemc
  • 3,021
  • 5
  • 34
  • 61
1
vote
3 answers

How to use AutoValue to parse JSON structured as an array of objects?

I have this JSON body: [ { "id": 0, "field1": "10", "field2": "22" }, { "id": 1, "field1": "11", "field2": "23" } ] My pojoItem: @AutoValue public abstract class PojoItem{ …
Maher Abuthraa
  • 17,493
  • 11
  • 81
  • 103