Questions tagged [immutables-library]

Use this tag for questions relating to the Immutables Library for Java.

99 questions
1
vote
1 answer

Immutables autogenerated for MongoDB throws "Can't find a codec for class Immutable.."

Problem Description. So I have an item that I want to use with MongoDB @Value.Immutable @Gson.TypeAdapters @Criteria.Repository interface Person { @Criteria.Id String id(); String fullName(); } And in-order to support pojos, I've…
Shahar Azar
  • 89
  • 3
  • 9
1
vote
0 answers

immutables.value.internal.$guava$.base.$VerifyException with java 17

I have problems getting my code to compile with maven. I'm using these dependencies: org.immutables value 2.9.0
1
vote
0 answers

Is it possible to generate a public default constructor as well as static factory method for an Immutables builder?

I'm trying to define a builder for an Immutables value that has both a public default constructor and a static factory method, i.e. new CustomerBuilder().name("Joe").age(21).build() AND CustomerBuilder.builder().name("Joe").age(21).build() I want…
1
vote
0 answers

Can I use an Immutables class as a gradle plugin extension

I'm writing a gradle plugin in Java. To make it configurable, I want to define an extension object. Since this is essentially a value object, I figured I'd use Immutables to define the class, to reduce the amount of code. However, this is turning…
Erik Hesselink
  • 2,420
  • 21
  • 25
1
vote
0 answers

Java Immutables merge object creation from optional fields

I'm working on a command line tool and I'm trying to minimize the amount of user input, but maximize the functionality. I've started going down the road of having a set of default inputs in the resources folder which allow the code to run with no…
1
vote
0 answers

Immutables @Value.Immutable public final fields (instead of getters)

I code in Kotlin mostly, but I also work on a project written in Java I would like to use the Immutables library to avoid writing boilerplate code I'm used to accessing my data class fields without any getters (e.g. config.value instead of…
Larik Borts
  • 353
  • 1
  • 3
  • 8
1
vote
1 answer

javascript immutables filter for unique student object by studentId field

I am new to using type script and immutables. I am not sure what is the best way to achieve this. I have an object of the below type export interface StudentProperties { studentId: number; studentName: string; active: boolean; subjects :…
serah
  • 2,057
  • 7
  • 36
  • 56
1
vote
1 answer

Inner immutable class with mapStruct

We are using Immutables with MapStruct and ran into a problem while converting an entity to dto. @Value.Immutable public interface ProjectDto { String getId(); String getName(); //ProjectStatisticsDto…
A_G
  • 2,260
  • 3
  • 23
  • 56
1
vote
1 answer

Backward compatibility when adding a new field in response

I am using Java Immutables for my request/response classes, which looks something like this: @JsonDeserialize(builder = ImmutableMyRequest.Builder.class) @Immutable public interface MyRequest { @Nullable String getA(); @NotNull String getB(); …
Rafay
  • 92
  • 8
1
vote
1 answer

Null collections converted to empty

By default, immutables.io will create empty collections if none are supplied. @Value.Immutable public abstract class MyTestPojo { public abstract List myList(); } The following will create the object with an empty collection: MyTestPojo…
Patrick
  • 90
  • 2
  • 8
1
vote
0 answers

org.immutables and hibernate: AnnotationException: No identifier specified for entity

I have been trying to use a class generated using org.immutables as hibernate @Entity. However, I keep getting Caused by: org.hibernate.AnnotationException: No identifier specified for entity: com.service.AbstractUserEntity My Entity…
Karthick
  • 2,844
  • 4
  • 34
  • 55
1
vote
1 answer

How to autogenerate a Unique ID from Immutables Criteria Library?

The advice given on Immutables site is to switch to the new Immutables-Criteria functionality. In this sense I try to convert my project so that instead of Immutables-MongoDB it uses the Immutables-Criteria . Immutables-MongoDB provides the…
Spyros K
  • 2,480
  • 1
  • 20
  • 37
1
vote
1 answer

How to disable @Generated annotation in Immutable generated class?

I am using Immutables-value for defining my POJO. And when it generates the Immutable* class, it has the @Generated annotation at the top. Is there any way I could disable it? I checked in their…
hatellla
  • 4,796
  • 8
  • 49
  • 101
1
vote
4 answers

Cannot configure IntelliJ Idea to use @Immutables annotations

I've followed the Immutables tutorial to use those annotations on IntelliJ Idea. For some reason the IDE is still showing the generated annotation classes as an error, though the maven compilation is going forward normally. Any idea how to fix this?
Squake
  • 370
  • 2
  • 10
1
vote
1 answer

How to use Immutables with public constructor but do not serialize to tuple style?

I am using Immutables and I configure my generated class to be instantiated through a constructor. @Gson.TypeAdapters @Value.Immutable(builder = false) @Value.Style( of = "new", allParameters = true, get = {"get*",…
Dennis
  • 646
  • 2
  • 6
  • 19