Lombok: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@Builder(toBuilder = true)
public class MyPojo {
public class MyPojo {
     @Getter(AccessLevel.NONE)
     @Getter(AccessLevel.NONE)
     private Boolean xxx;
     private Boolean xxx;
     public Boolean isXxx() {
     public Boolean isXxx() {
         return xxx;
         return xxx;
Line 22: Line 22:
@AllArgsConstructor
@AllArgsConstructor
@SuperBuilder(toBuilder = true)
@SuperBuilder(toBuilder = true)
public class Parent implements Serializable {
 
public class Parent {
     //parent properties
     //parent properties




Line 39: Line 39:
@SuperBuilder(toBuilder = true)
@SuperBuilder(toBuilder = true)
@EqualsAndHashCode(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class Child extends Parent implements Serializable {
public class Child extends Parent {
     //child properties
     //child properties



Revision as of 20:10, 18 December 2023

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder(toBuilder = true)

public class MyPojo {
    @Getter(AccessLevel.NONE)
    private Boolean xxx;
    public Boolean isXxx() {
        return xxx;
    }
}
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder(toBuilder = true)

public class Parent {
    //parent properties




}
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder(toBuilder = true)
@EqualsAndHashCode(callSuper = true)
public class Child extends Parent {
    //child properties




}

Maven Dependency

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.18.10</version>
    <scope>provided</scope>
</dependency>

References