Lombok: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
{|
| valign="top" |
<source lang="java">
<source lang="java">
@Data
@Data
Line 13: Line 15:
}
}
</source>
</source>
| valign="top" |
<source lang="java">
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder(toBuilder = true)
public class Parent implements Serializable {
    private static final long serialVersionUID = -8105130806440199764L;
    //parent properties
}
</source>
| valign="top" |
<source lang="java">
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder(toBuilder = true)
@EqualsAndHashCode(callSuper = true)
public class Child extends Parent implements Serializable {
    private static final long serialVersionUID = 7019427971520232427L;
    //child properties
}
</source>
|}


==Maven Dependency==
==Maven Dependency==

Revision as of 04:31, 18 December 2023

@Data
@NoArgsConstructor
@AllArgsConstructor
public class MyPojo {

    @Getter(AccessLevel.NONE)
    private Boolean xxx;

    public Boolean isXxx() {
        return xxx;
    }
}
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder(toBuilder = true)
public class Parent implements Serializable {
    private static final long serialVersionUID = -8105130806440199764L;

    //parent properties



}
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder(toBuilder = true)
@EqualsAndHashCode(callSuper = true)
public class Child extends Parent implements Serializable {
    private static final long serialVersionUID = 7019427971520232427L;

    //child properties


}

Maven Dependency

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

References