简体   繁体   中英

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

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!!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM