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

Using JDBI @BindBean with AutoValue

TLDR; The JDBI @BindBean annotation generates an IllegalAccessException with AutoValue generated types because the generated types are package private and by default can't be accessed by default using reflection. Is JDBI inflexible or is there a…
vpiTriumph
  • 3,116
  • 2
  • 27
  • 39
5
votes
1 answer

Maven-dependency-plugin and annotations with SOURCE RetentionPolicy

In a mvn project where I am utilizing maven-dependency-plugin to detect unused dependencies, there is seemingly no dependency scope I can specify for Google's AutoValue (com.google.auto.value:auto-value) to that will convince the plugin that the…
vpiTriumph
  • 3,116
  • 2
  • 27
  • 39
4
votes
0 answers

How to use javax validation with autovalue builder?

How can I validate properties of my autovalue generated java model using javax validation ? @AutoValue @JsonDeserialize(builder = AutoValue_Animal.Builder.class) @JsonIgnoreProperties(ignoreUnknown = true) public abstract class Animal { …
louis amoros
  • 2,418
  • 3
  • 19
  • 40
4
votes
1 answer

Nested list objects with AutoValue/Gson fails with NoSuchMethodError

I'm trying to use a JSON object to convert to a Java object (build with AutoValue) using Gson. The JSON object looks like: { "id": 1, "name": "Nutella Pie", "ingredients": [ { "quantity": 2, "measure":…
David Pena
  • 163
  • 3
  • 9
4
votes
1 answer

Android Gradle annotationProcessor not available in parent module

I'm having the following setup: ProjectA build.gralde: dependencies { compile (project(':ProjectB')) } ProjectB build.gradle: dependencies { annotationProcessor 'com.ryanharter.auto.value:auto-value-parcel:0.2.5' compile…
dkarmazi
  • 3,199
  • 1
  • 13
  • 25
4
votes
1 answer

AutoValue Gson type adapter for a Map>

I'm trying to find a way to use AutoValue to deserialize a JSON obj to a Java class (which is also Parcelable) The JSON response is usually in the form of, { "varKey1": { "occupations": [ { "value": "val1", "name":…
source.rar
  • 8,002
  • 10
  • 50
  • 82
4
votes
0 answers

@AutoValue is not working on Intellij 2016.1.3

I was try to use Google's @AutoValue. But, It's not working on my Intellij. Step.1 I was maked this class import com.google.auto.value.AutoValue; @AutoValue public abstract class Example { public static Example create(String name, int integer) { …
seyeon
  • 4,092
  • 2
  • 15
  • 12
4
votes
1 answer

Call Groovy builder from Java

I'm trying to use Groovy (which is new to me) to replace Java value object classes with a Groovy equivalent and thus obtain a cleaner and more concise code, while remaining compatible with the rest of the Java codebase. (if this attempt fails, I may…
4
votes
2 answers

Eclipse AutoValue class fails to build

I'm running Eclipse Kepler SR2, with Maven 3.1.1 attached with the m2e and m2e-apt plugins, and I'm getting an error I don't know how to resolve. I managed to find all the dependencies needed to get @AutoValue working into my pom.xml, but now I'm in…
torquestomp
  • 3,304
  • 19
  • 26
3
votes
1 answer

Marsheling error "does not have a no-arg default constructor" when using JAXB with AutoValue

Given the following class: @XmlRootElement(name = "Person") @AutoValue @CopyAnnotations public abstract class Person { @XmlElement abstract String name(); public static Builder builder() { return new AutoValue_Person.Builder(); } …
Humble Student
  • 3,755
  • 4
  • 20
  • 35
3
votes
1 answer

AutoValue sample: error: cannot find symbol class AutoValue_Animal

I'm trying to learn about @AutoValue. I follow the example in https://github.com/google/auto/blob/master/value/userguide/index.md I'm using Android Studio 3.4 I add my gradle dependency implementation…
Elye
  • 53,639
  • 54
  • 212
  • 474
3
votes
1 answer

How to configure Auto-Value with Eclipse and Gradle?

I want to use Google’s Auto-Value in a Gradle java-library project in Eclipse. My class: @AutoValue public abstract class Pairing implements Comparable { static Pairing create(final Participant white, final Participant black) { …
3
votes
1 answer

AutoValue cannot be resolved to a type - Eclipse

Trying to use AutoValue of package com.google.auto.value.AutoValue in my java class and get error "AutoValue cannot be resolved to a type" I have added this in pom.xml