alwaysAStudent
alwaysAStudent

Reputation: 2264

lombok @AllArgsConstructor constructor

I am new to lombok. I have defined the below model using lombok. However when I try to create a object of the model with parameters, it gives an error stating Paramterized connstructor is not defined. From what I have read, @AllArgsConstructor, @NoArgsConstructor should create both a paramterized and default constructor. I am able to access my parameters so I am sure lombok is setup correctly.

Am I missing something here?

 @Data
 @AllArgsConstructor
 @NoArgsConstructor
 public class SomeObjectModel {

   @JsonProperty("task")
   State task;

   @JsonProperty("time")
   long time;

   @JsonProperty("bool")
   boolean bool;
}

Thanks

Upvotes: 0

Views: 5735

Answers (1)

Gustavo Ponce
Gustavo Ponce

Reputation: 457

You need to install Lombok in your IDE (based on your post tags seems that you are using Eclipse)

Steps:

  1. In your maven dependencies check your Lombok jar location (As alternative you can download the jar file directly from the Lombok web site) Lombok location
  2. Close Eclipse
  3. Open a command line where the Lombok jar file is located
  4. Execute java -jar lombok-[VERSION].jar (An installation wizard will be opened) Installation wizard
  5. Out of the box the wizard will try to find your IDE installation, if the wizard doesn't find it, then you will have to provide the path
  6. Click on "Install/Update" button
  7. Close the installation wizard and open Eclipse
  8. Update your maven project Update project

I hope it helps!!!

Upvotes: 1

Related Questions