Lombok with Second Capital problem
in developCo-De with 0 comment

Lombok with Second Capital problem

in developCo-De with 0 comment

Problem

Code

@Data
public class DemoObj {
    private String pId;
}
public class Client {
  public static void main(String[] args) {
    // will change to pid
    DemoObj demoObj = new DemoObj();
    demoObj.setPId("1");
    String a = JsonHelper.toJson(demoObj);
    System.out.println(a);
    // will match setPId method
    String b = "{\"pid\":\"1\"}"; 
    DemoObj demoObj1 = JsonHelper.readValue(b, DemoObj.class);
    System.out.println(demoObj1.getPId());
    // will not match
    String c = "{\"pId\":\"1\"}"; 
    DemoObj demoObj2 = JsonHelper.readValue(c, DemoObj.class);
    System.out.println(demoObj2.getPId());
  }
}
{"pid":"1"}
1
null

Comment

Comments are closed.