Questions tagged [immutables-library]

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

99 questions
1
vote
1 answer

How to compile project with only `mvn clean install` without having to subsequently run `mvn install`?

I am trying to compile project which uses both Mapstruct and Immutables. The only solution which solves my problem is to run: mvn clean compile -> fails with compilation failure; cannot find generated classes from Immutables mvn compile ->…
bobo
  • 33
  • 1
  • 4
1
vote
1 answer

Immutables wrapper as string in Jackson

How can I jackson serialize a wrapper type to and from a string? I merged the following from two different examples their website. But the HostName type is serialized/deserialized as { "name" : "my.host.name.com" } when I want it to be simply the…
Michael Deardeuff
  • 10,386
  • 5
  • 51
  • 74
1
vote
0 answers

Why declared immuables library style in package-info.java doesn't apply for subpackages in java 9 project?

Please see https://github.com/originalrusyn/java9_immutables for more details So, the following config works correctly with sourceCompatibility = 1.8 p.package-info.java @Value.Style( defaults = @Value.Immutable(copy = false), strictBuilder…
1
vote
0 answers

Is it possible to combine org.immutable:value's builders with hibernate's @Entity?

I really like immutables.github.io's immutables:value annotation processor (@Value.Immutable, @Value.Modifiable, et al). I have a project using hibernate with quite a few entities. I'd love to have builders generated for me by the immutables…
Martin
  • 3,703
  • 2
  • 21
  • 43
1
vote
1 answer

Jackson Subclass serialization

I'm using an java API that I do not own and cannot modify. That API defines a class Aggregation which is a Immutables (immutables.github.io) abstract class with Jackson serialization and deserialization. The class looks like…
marisbest2
  • 1,346
  • 2
  • 17
  • 30
1
vote
1 answer

How would it be advised to get Immutables to build this object with this sort

How could I get Immutables to generate a class with this sort public class IdentifiedUserDetails implements UserDetails, CredentialsContainer, Identified { private static final long serialVersionUID = 4905378177558522349L; private…
xenoterracide
  • 16,274
  • 24
  • 118
  • 243
1
vote
1 answer

Java Immutables Library: Check if all Optionals are empty?

I'd like to determine whether all Optional members of an immutable are empty. Is there a way to do this automatically without checking all the known Optionals by hand? I'm concerned that even if do write a check for each Optional member someone will…
lf215
  • 1,185
  • 7
  • 41
  • 83
0
votes
0 answers

Deserialize a map to POJO object containing a List of Immutable Type

While building an API, I was trying to deserialize a map object into an immutableInterface KycMetadata(which contains a list of another immutable Interface InternalComponent) Details are as follows, kindly…
0
votes
2 answers

Deserialize Json Object containing map with null values to Immutable with Jackson

I'm trying to deserialize a Json object that contains the following structure but am getting an error from Jackson during deserialization due to null values appearing in the the map containing the Json object. Is there a way to deserialize these…
0
votes
0 answers

Java Immutables builder interface defintion in parent class?

In the Immutables documentation it says that: For advanced use cases, it may be desirable to have builders that produce different types of objects but conform to the same interface, akin to the original Builder pattern. This is achievable by…
ciferkey
  • 2,064
  • 3
  • 20
  • 28
0
votes
0 answers

How to make defensive copying in Immutables Java library?

I've been playing with the Immutables Java library for a while and I was wondering if there's any way of making defensive copying. Please consider the following code: @Value.Immutable public interface Employee { String getName(); Integer…
akatsuki
  • 27
  • 8
0
votes
2 answers

JavaScript Executor Scroll Gesture Immutable Maps Arguments Issue

boolean canScrollMore = (Boolean) ((JavascriptExecutor) driver).executeScript("mobile: scrollGesture", ImmutableMap.of( "left", 100, "top", 100, "width", 200, "height", 200, "direction", "down", "percent",…
0
votes
1 answer

Using Jackson and Immutables to create a Map from certain CSV columns

I have a CSV that I'm parsing through Jackson to create list of immutable type for each row. The CSV has some columns to represent a collection like: Name,Age,Height,Item1,Item2,Item3,Item4,Item5 AB,1,1.123,ABC,DEF,GHI,JKL,MNO At present I'm…
trickster
  • 75
  • 1
  • 9
0
votes
1 answer

Maven compiler plugin issue with custom annotation processor

I have written a custom annotation processor and configured with maven compiler plugin as shown below, I am facing issue with Immutables annotation processor which is in my application class path. When I add my annotation processor via maven…
0
votes
1 answer

Spring Boot Immutable validation only work with get prefix

I am trying to implement Javax Validation on Immutable objects, but I only get it working by renaming every variable with prefix "get". It is possible to make it work without that "get" ? @Value.Immutable public interface Entity { …
John
  • 1,697
  • 4
  • 27
  • 53