Skip to content

Commit cda5940

Browse files
author
coursar
committed
feat(inheritance): lombok with inheritance
1 parent ad03459 commit cda5940

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>ru.netology</groupId>
8+
<artifactId>lombok-inheritance</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<maven.compiler.source>11</maven.compiler.source>
13+
<maven.compiler.target>11</maven.compiler.target>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>org.projectlombok</groupId>
20+
<artifactId>lombok</artifactId>
21+
<version>1.18.12</version>
22+
<scope>provided</scope>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.junit.jupiter</groupId>
26+
<artifactId>junit-jupiter</artifactId>
27+
<version>5.4.2</version>
28+
<scope>test</scope>
29+
</dependency>
30+
<dependency>
31+
<groupId>org.mockito</groupId>
32+
<artifactId>mockito-junit-jupiter</artifactId>
33+
<version>3.3.3</version>
34+
<scope>test</scope>
35+
</dependency>
36+
</dependencies>
37+
38+
<build>
39+
<plugins>
40+
<plugin>
41+
<groupId>org.apache.maven.plugins</groupId>
42+
<artifactId>maven-surefire-plugin</artifactId>
43+
<version>2.22.2</version>
44+
</plugin>
45+
</plugins>
46+
</build>
47+
48+
49+
</project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package ru.netology.domain;
2+
3+
import lombok.Data;
4+
import lombok.EqualsAndHashCode;
5+
6+
@Data
7+
@EqualsAndHashCode(callSuper = true)
8+
public class Book extends Product {
9+
private String author;
10+
private int pages;
11+
private int publishedYear;
12+
13+
public Book() {
14+
}
15+
16+
public Book(int id, String name, int price, String author, int pages, int publishedYear) {
17+
super(id, name, price);
18+
this.author = author;
19+
this.pages = pages;
20+
this.publishedYear = publishedYear;
21+
}
22+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package ru.netology.domain;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Data;
5+
import lombok.NoArgsConstructor;
6+
7+
@NoArgsConstructor
8+
@AllArgsConstructor
9+
@Data
10+
public class Product {
11+
private int id;
12+
private String name;
13+
private int price;
14+
}

0 commit comments

Comments
 (0)