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
0
votes
0 answers

Expected BEGIN_OBJECT but was STRING at ... for a correct json string

I am using autovalue gson to serialize and deserialize java objects. I have introduced a response class model which indicates a model corresponding to a response of an API. However, when I am trying to test the json deserialization I am constantly…
Sunil Kumar
  • 390
  • 1
  • 7
  • 25
0
votes
0 answers

AutoValue Negative Check

Can an AutoValue class do a negative check similar to how it checks for Missing required properties? Maybe it can support validation by annotations? @AutoValue @JsonSerialize(as = ExampleRequest.class) @JsonDeserialize(builder =…
user3654542
  • 76
  • 1
  • 4
0
votes
1 answer

Do I need immutable collections in @AutoValue classes?

Is a class generated with @AutoValue immutable? Can I use it instead of creating the class myself and making sure it can be annotated @Immutable?
John Caron
  • 1,367
  • 1
  • 10
  • 15
0
votes
0 answers

Issue with external jar having AutoValue generated classes

I have a "jar-a" which has AutoValue generated class files. When I add that jar as external library to another maven project, those autovalue generated classes are not appearing and when I run my project I get java.lang.NoClassDefFoundError. Is this…
0
votes
2 answers

Deserialize class with @AutoValue annotation during getting from cache in SpringBoot application

I've created a value class with com.google.auto.value.AutoValue annotation: @AutoValue @JsonDeserialize(builder = AutoValue_Company.Builder.class) public abstract class Company { public static Builder newBuilder() { return new…
Uladzislau Kaminski
  • 2,113
  • 2
  • 14
  • 33
0
votes
1 answer

Is there anything similar to Java AutoValue in C#?

After working on a Java project for some time then coming back to C#, I've found myself really missing AutoValue. Specifically, I'd like the ability to: Produce an immutable value class with minimal boilerplate. Have things like equality and hash…
0
votes
2 answers

Add auto value to Access table

I've an import from Excel to Access. It works pretty well. My only problem is that after the import there is no column with auto value (primary key). This is my import: Private Sub Befehl1_Click() DoCmd.TransferSpreadsheet acImport, 10, _ …
jasz21
  • 1
0
votes
1 answer

Why does my AutoValueExtension annotation not work?

I have been trying to use Square's Redacted annotation to redact a pin from a toString() method in my auto generated class but the extension is not being applied. It seems like the extension is not read by the class loader. The @AutoValue annotation…
Patch
  • 21
  • 3
0
votes
0 answers

How to set default value with Auto Value Gson 1.0.0

Have had a very old version of Auto Value Gson (0.4.4alpha) from Ryan Harter. Now we want to migrate to something more current (1.0.0). However, something that is missing for me are the default values of the properties when deserializing - I used to…
Boris Strandjev
  • 46,145
  • 15
  • 108
  • 135
0
votes
1 answer

How to use MapStruct for immutable value class by AutoValue (for Android)

I cannot figure out how to use mapstruct 1.3 with Google's @AutoValue. I'm trying to do it on Android, but I doubt that is related to my issues. Are there any documentation on this or examples? I've posted in the maptruct issues regarding lack of…
arberg
  • 4,148
  • 4
  • 31
  • 39
0
votes
1 answer

JavaPoet - Writing a call to a static generic method

I want to write a CodeBlock which is basically calling a static generic method, but the output I get with JavaPoet is generating compiler errors. For example given the following auto value class: @AutoValue public abstract class Test { public…
smac89
  • 39,374
  • 15
  • 132
  • 179
0
votes
0 answers

Is it possible to automatically generate (and update) the implementation of Hashable in Swift?

In Java it is possible to automatically generate implementations of toString(), hashCode(), and equals(Object), for value objects using the AutoValue library. The advantages are (among others) that these methods are automatically updated when adding…
rinde
  • 1,181
  • 1
  • 8
  • 20
0
votes
0 answers

Why do I keep getting `isBoxedPrimitive()` error when building the project?

Error:Execution failed for task ':app:compileDebugJavaWithJavac'. > java.lang.NoSuchMethodError: com.squareup.javapoet.TypeName.isBoxedPrimitive()Z I keep getting the same error when using auto-value-parcel and auto-value-firebase. The project…
John Ernest Guadalupe
  • 6,379
  • 11
  • 38
  • 71
0
votes
1 answer

How to skip generation of testBuilder with AutoValue in generic class

Autovalue version: 1.3 Given the following class: @AutoValue public abstract class SimpleClass { public static SimpleClass create(Set someField) { return SimpleClass.builder().someField(someField).build(); …
smac89
  • 39,374
  • 15
  • 132
  • 179
0
votes
1 answer

How to update model value in android

I am using AutoValue in my models, I want to update the isTrue() value of the model when the user does something. So I need help. Here is my model. @AutoValue public abstract class Xyz implements Parcelable { @SerializedName("isTrue") …
shivam
  • 445
  • 1
  • 8
  • 22