SlideShare une entreprise Scribd logo
1  sur  36
Télécharger pour lire hors ligne
Lombok
2017-07-20
onozaty
Lombok?
• Java (
)
•
• getter/setter
• equals, hashCode
• toString
•
Lombok?
•
@Getter
@Setter
public class Customer {
private int id;
private String name;
}
public class Customer {
private int id;
private String name;
public int getId() {
return this.id;
}
public String getName() {
return this.name;
}
public void setId(final int id) {
this.id = id;
}
public void setName(final String name) {
this.name = name;
}
}
Lombok?
• IDE IDE
• Lombok
( )
• IDE
• Eclipse Lombok jar
Eclipse
( )
@Getter, @Setter
• getter/setter
• (
)
• (
public)
• final setter (
)
@Getter, @Setter
public class GetterSetterExample {
//
@Getter
@Setter
private int id;
//
@Setter(AccessLevel.PROTECTED)
private String name;
}
public class GetterSetterExample {
private int id;
private String name;
public int getId() {
return this.id;
}
public void setId(final int id) {
this.id = id;
}
protected void setName(final String name) {
this.name = name;
}
}
@ToString
•
toString
•
@ToString
@ToString
public class ToStringExample {
private int id;
private String name;
public String getName() {
return name;
}
}
// exclude
@ToString(exclude = "name")
class ToStringExample2 {
private int id;
private String name;
}
public class ToStringExample {
private int id;
private String name;
public String getName() {
return name;
}
@Override
public String toString() {
return "ToStringExample(id=" + this.id
+ ", name=" + this.getName() + ")";
}
}
class ToStringExample2 {
private int id;
private String name;
@Override
public String toString() {
return "ToStringExample2(id="
+ this.id + ")";
}
}
@EqualsAndHashCode
• equals hashCode
•
•
Lombok
@EqualsAndHashCode
@EqualsAndHashCode
public class EqualsAndHashCodeExample
{
private int id;
private String name;
}
//
@EqualsAndHashCode(exclude = "age")
class EqualsAndHashCodeExample2 {
private int id;
private String name;
private int age;
}
public class EqualsAndHashCodeExample {
private int id;
private String name;
@Override
public boolean equals(final Object o) { … }
@Override
public int hashCode() { … }
}
public class EqualsAndHashCodeExample2 {
private int id;
private String name;
private int age;
// age
@Override
public boolean equals(final Object o) { … }
@Override
public int hashCode() { … }
}
@AllArgsConstructor,
@NoArgsConstructor,
@RequiredArgsConstructor
•
• @AllArgsConstructor
• @NoArgsConstructor
• @RequiredArgsConstructor final
(final
)
@AllArgsConstructor,
@NoArgsConstructor,
@RequiredArgsConstructor
@AllArgsConstructor
@NoArgsConstructor
public class ConstructorExample {
private int id;
private String name;
}
@RequiredArgsConstructor
class ConstructorExample2 {
private final int id;
private String name;
}
public class ConstructorExample {
private int id;
private String name;
public ConstructorExample(
final int id, final String name) {
this.id = id;
this.name = name;
}
public ConstructorExample() {
}
}
class ConstructorExample2 {
private final int id;
private String name;
public ConstructorExample2(final int id) {
this.id = id;
}
}
@Data
•
• @ToString
• @EqualsAndHashCode
• @Getter
• @Setter
• @RequiredArgsConstructor
•
@Data
@Data
public class DataExample {
private final int id;
private String name;
}
public class DataExample {
private final int id;
private String name;
public DataExample(final int id) {
this.id = id;
}
public int getId() {
return this.id;
}
public String getName() {
return this.name;
}
public void setName(final String name) {
this.name = name;
}
@Override
public boolean equals(final Object o) { … }
@Override
public int hashCode() { … }
@Override
public String toString() { … }
}
@Value
• final
• @ToString
• @EqualsAndHashCode
• @Getter
• @RequiredArgsConstructor
• Immutable
@Value
@Value
public class ValueExample {
private int id;
private String name;
}
public final class ValueExample {
private final int id;
private final String name;
public ValueExample(
final int id, final String name) {
this.id = id;
this.name = name;
}
public int getId() {
return this.id;
}
public String getName() {
return this.name;
}
@Override
public boolean equals(final Object o) { … }
@Override
public int hashCode() { … }
@Override
public String toString() { … }
}
@Builder
• Builder (GoF Effective
Java ) Builder
• Builder
@Builder
public static void main(String[] args) {
// Builder ( )
Customer customer = new Customer(
"Taro",
"Yamada",
"Tokyo",
Arrays.asList("A", "B"));
System.out.println(customer);
}
@AllArgsConstructor
@ToString
class Customer {
private String firstName;
private String lastName;
private String city;
private List<String> tags;
}
public static void main(String[] args) {
// Builder
Customer customer = Customer.builder()
.firstName("Taro")
.lastName("Yamada")
.city("Tokyo")
.tag("A")
.tag("B")
.build();
System.out.println(customer);
}
@Builder
@ToString
class Customer {
private String firstName;
private String lastName;
private String city;
@Singular
private List<String> tags;
}
@Slf4j
• log static Logger
• Slf4j Apache commons log(@Log)
• Logger
@Slf4j
@Slf4j
public class LogExample {
public static void main(String[] args) {
log.info("main.");
}
}
public class LogExample {
private static final org.slf4j.Logger log =
org.slf4j.LoggerFactory.getLogger(LogExample.class);
public static void main(String[] args) {
log.info("main.");
}
}
@NonNull
• null
(null
NullPointerException )
• Objects.requireNonNull
@NonNull
@RequiredArgsConstructor
public class NonNullExample {
@NonNull
private String name;
public void printLength(
@NonNull String message) {
System.out.println(
message.length());
}
}
public class NonNullExample {
@NonNull
private String name;
public void printLength(
@NonNull String message) {
if (message == null) {
throw new NullPointerException("message");
}
System.out.println(message.length());
}
public NonNullExample(
@NonNull final String name) {
if (name == null) {
throw new NullPointerException("name");
}
this.name = name;
}
}
val
•
• Scala val
val
public static void main(String[] args) {
val list = new ArrayList<String>();
list.add("a");
list.add("b");
val item = list.get(0);
System.out.println(item);
}
public static void main(String[] args) {
final ArrayList<String> list =
new ArrayList<String>();
list.add("a");
list.add("b");
final String item = list.get(0);
System.out.println(item);
}
@Cleanup
•
( )
close
• try/finally
• close
@Cleanup
public static void main(String[] args) throws IOException {
Path filePath = Paths.get(args[0]);
@Cleanup BufferedReader reader = Files.newBufferedReader(filePath);
System.out.println(reader.readLine());
}
public static void main(String[] args) throws IOException {
Path filePath = Paths.get(args[0]);
BufferedReader reader = Files.newBufferedReader(filePath);
try {
System.out.println(reader.readLine());
} finally {
if (Collections.singletonList(reader).get(0) != null) {
reader.close();
}
}
}
@Synchronized
• synchronized
• static
Lock
• Lock
@Synchronized
public class SynchronizedExample {
@Synchronized
public static void hello() {
System.out.println("hello");
}
@Synchronized
public void bye() {
System.out.println("bye");
}
}
public class SynchronizedExample {
private static final Object $LOCK = new Object[0];
private final Object $lock = new Object[0];
public static void hello() {
synchronized (SynchronizedExample.$LOCK) {
System.out.println("hello");
}
}
public void bye() {
synchronized (this.$lock) {
System.out.println("bye");
}
}
}
@SneakyThrows
• (
)
•
•
• https://github.com/rzwitserloot/lombok/blob/master/src/core/
lombok/Lombok.java#L49
• Lombok
Lombok jar
@SneakyThrows
public class SneakyThrowsExample {
@SneakyThrows
public static void main(String[] args) {
throw new Exception();
}
}
public class SneakyThrowsExample {
public static void main(String[] args) {
try {
throw new Exception();
} catch (final Throwable $ex) {
throw Lombok.sneakyThrow($ex);
}
}
}
delombok
• delombok Lombok
• delombok
• https://projectlombok.org/features/delombok
> java -jar lombok.jar delombok src -d src-delomboked
• Lombok
onMethd onParam
• https://projectlombok.org/features/experimental/onX
Lombok
•
•
• getter/setter
•
• equals hashCode
Lombok
•
• Lombok
• Lombok
Lombok
• val @Cleanup @SneakyThrows
(Lombok
)
•
Lombok
• https://projectlombok.org/features/all

Contenu connexe

Tendances

Basic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time APIBasic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time APIjagriti srivastava
 
Excuse me, sir, do you have a moment to talk about tests in Kotlin
Excuse me, sir, do you have a moment to talk about tests in KotlinExcuse me, sir, do you have a moment to talk about tests in Kotlin
Excuse me, sir, do you have a moment to talk about tests in Kotlinleonsabr
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsMuhammadTalha436
 
Introduction To Csharp
Introduction To CsharpIntroduction To Csharp
Introduction To Csharpg_hemanth17
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharpsinghadarsh
 
Introduction to CSharp
Introduction to CSharpIntroduction to CSharp
Introduction to CSharpMody Farouk
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharpRaga Vahini
 
Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.Nishan Barot
 
Using Xcore with Xtext
Using Xcore with XtextUsing Xcore with Xtext
Using Xcore with XtextHolger Schill
 
Java and XML Schema
Java and XML SchemaJava and XML Schema
Java and XML SchemaRaji Ghawi
 
C# 7.0 Hacks and Features
C# 7.0 Hacks and FeaturesC# 7.0 Hacks and Features
C# 7.0 Hacks and FeaturesAbhishek Sur
 
Swift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-CSwift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-CAlexis Gallagher
 
4java Basic Syntax
4java Basic Syntax4java Basic Syntax
4java Basic SyntaxAdil Jafri
 
Modul Praktek Java OOP
Modul Praktek Java OOP Modul Praktek Java OOP
Modul Praktek Java OOP Zaenal Arifin
 

Tendances (18)

Basic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time APIBasic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time API
 
Excuse me, sir, do you have a moment to talk about tests in Kotlin
Excuse me, sir, do you have a moment to talk about tests in KotlinExcuse me, sir, do you have a moment to talk about tests in Kotlin
Excuse me, sir, do you have a moment to talk about tests in Kotlin
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ Exams
 
Java Programming - 06 java file io
Java Programming - 06 java file ioJava Programming - 06 java file io
Java Programming - 06 java file io
 
Sam wd programs
Sam wd programsSam wd programs
Sam wd programs
 
Introduction To Csharp
Introduction To CsharpIntroduction To Csharp
Introduction To Csharp
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
 
Introduction to CSharp
Introduction to CSharpIntroduction to CSharp
Introduction to CSharp
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
 
Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.Final JAVA Practical of BCA SEM-5.
Final JAVA Practical of BCA SEM-5.
 
Using Xcore with Xtext
Using Xcore with XtextUsing Xcore with Xtext
Using Xcore with Xtext
 
Java and XML Schema
Java and XML SchemaJava and XML Schema
Java and XML Schema
 
C# 7.0 Hacks and Features
C# 7.0 Hacks and FeaturesC# 7.0 Hacks and Features
C# 7.0 Hacks and Features
 
Java Concurrency by Example
Java Concurrency by ExampleJava Concurrency by Example
Java Concurrency by Example
 
Swift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-CSwift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-C
 
4java Basic Syntax
4java Basic Syntax4java Basic Syntax
4java Basic Syntax
 
Java practical
Java practicalJava practical
Java practical
 
Modul Praktek Java OOP
Modul Praktek Java OOP Modul Praktek Java OOP
Modul Praktek Java OOP
 

Similaire à Lombokの紹介

3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в Java3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в JavaDEVTYPE
 
Creating a Facebook Clone - Part XIX.pdf
Creating a Facebook Clone - Part XIX.pdfCreating a Facebook Clone - Part XIX.pdf
Creating a Facebook Clone - Part XIX.pdfShaiAlmog1
 
A evolução da persistência de dados (com sqlite) no android
A evolução da persistência de dados (com sqlite) no androidA evolução da persistência de dados (com sqlite) no android
A evolução da persistência de dados (com sqlite) no androidRodrigo de Souza Castro
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokusHamletDRC
 
Android Architecure Components - introduction
Android Architecure Components - introductionAndroid Architecure Components - introduction
Android Architecure Components - introductionPaulina Szklarska
 
Creating a Facebook Clone - Part XX.pdf
Creating a Facebook Clone - Part XX.pdfCreating a Facebook Clone - Part XX.pdf
Creating a Facebook Clone - Part XX.pdfShaiAlmog1
 
Kotlin Data Model
Kotlin Data ModelKotlin Data Model
Kotlin Data ModelKros Huang
 
[2019] PAYCO 매거진 서버 Kotlin 적용기
[2019] PAYCO 매거진 서버 Kotlin 적용기[2019] PAYCO 매거진 서버 Kotlin 적용기
[2019] PAYCO 매거진 서버 Kotlin 적용기NHN FORWARD
 
Domänenspezifische Sprachen mit Xtext
Domänenspezifische Sprachen mit XtextDomänenspezifische Sprachen mit Xtext
Domänenspezifische Sprachen mit XtextDr. Jan Köhnlein
 
create-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdfcreate-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdfShaiAlmog1
 
CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodecamp Romania
 
14. Defining Classes
14. Defining Classes14. Defining Classes
14. Defining ClassesIntro C# Book
 
NOSQL part of the SpringOne 2GX 2010 keynote
NOSQL part of the SpringOne 2GX 2010 keynoteNOSQL part of the SpringOne 2GX 2010 keynote
NOSQL part of the SpringOne 2GX 2010 keynoteEmil Eifrem
 
Creating a Facebook Clone - Part XIX - Transcript.pdf
Creating a Facebook Clone - Part XIX - Transcript.pdfCreating a Facebook Clone - Part XIX - Transcript.pdf
Creating a Facebook Clone - Part XIX - Transcript.pdfShaiAlmog1
 
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdf
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdfplease navigate to cs112 webpage and go to assignments -- Trees. Th.pdf
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdfaioils
 

Similaire à Lombokの紹介 (20)

3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в Java3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в Java
 
Creating a Facebook Clone - Part XIX.pdf
Creating a Facebook Clone - Part XIX.pdfCreating a Facebook Clone - Part XIX.pdf
Creating a Facebook Clone - Part XIX.pdf
 
A evolução da persistência de dados (com sqlite) no android
A evolução da persistência de dados (com sqlite) no androidA evolução da persistência de dados (com sqlite) no android
A evolução da persistência de dados (com sqlite) no android
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokus
 
Dev Day Andreas Roth.pdf
Dev Day Andreas Roth.pdfDev Day Andreas Roth.pdf
Dev Day Andreas Roth.pdf
 
OOP Lab Report.docx
OOP Lab Report.docxOOP Lab Report.docx
OOP Lab Report.docx
 
Android Architecure Components - introduction
Android Architecure Components - introductionAndroid Architecure Components - introduction
Android Architecure Components - introduction
 
Creating a Facebook Clone - Part XX.pdf
Creating a Facebook Clone - Part XX.pdfCreating a Facebook Clone - Part XX.pdf
Creating a Facebook Clone - Part XX.pdf
 
Kotlin Data Model
Kotlin Data ModelKotlin Data Model
Kotlin Data Model
 
[2019] PAYCO 매거진 서버 Kotlin 적용기
[2019] PAYCO 매거진 서버 Kotlin 적용기[2019] PAYCO 매거진 서버 Kotlin 적용기
[2019] PAYCO 매거진 서버 Kotlin 적용기
 
Java2
Java2Java2
Java2
 
Domänenspezifische Sprachen mit Xtext
Domänenspezifische Sprachen mit XtextDomänenspezifische Sprachen mit Xtext
Domänenspezifische Sprachen mit Xtext
 
create-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdfcreate-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdf
 
Architecure components by Paulina Szklarska
Architecure components by Paulina SzklarskaArchitecure components by Paulina Szklarska
Architecure components by Paulina Szklarska
 
CodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical GroovyCodeCamp Iasi 10 march 2012 - Practical Groovy
CodeCamp Iasi 10 march 2012 - Practical Groovy
 
14. Defining Classes
14. Defining Classes14. Defining Classes
14. Defining Classes
 
NOSQL part of the SpringOne 2GX 2010 keynote
NOSQL part of the SpringOne 2GX 2010 keynoteNOSQL part of the SpringOne 2GX 2010 keynote
NOSQL part of the SpringOne 2GX 2010 keynote
 
Creating a Facebook Clone - Part XIX - Transcript.pdf
Creating a Facebook Clone - Part XIX - Transcript.pdfCreating a Facebook Clone - Part XIX - Transcript.pdf
Creating a Facebook Clone - Part XIX - Transcript.pdf
 
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdf
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdfplease navigate to cs112 webpage and go to assignments -- Trees. Th.pdf
please navigate to cs112 webpage and go to assignments -- Trees. Th.pdf
 
Green dao 3.0
Green dao 3.0Green dao 3.0
Green dao 3.0
 

Plus de onozaty

チームで開発するための環境を整える
チームで開発するための環境を整えるチームで開発するための環境を整える
チームで開発するための環境を整えるonozaty
 
Selenium入門(2023年版)
Selenium入門(2023年版)Selenium入門(2023年版)
Selenium入門(2023年版)onozaty
 
40歳過ぎてもエンジニアでいるためにやっていること
40歳過ぎてもエンジニアでいるためにやっていること40歳過ぎてもエンジニアでいるためにやっていること
40歳過ぎてもエンジニアでいるためにやっていることonozaty
 
Java8から17へ
Java8から17へJava8から17へ
Java8から17へonozaty
 
今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -
今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -
今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -onozaty
 
Redmine issue assign notice plugin の紹介
Redmine issue assign notice plugin の紹介Redmine issue assign notice plugin の紹介
Redmine issue assign notice plugin の紹介onozaty
 
最近作ったもの
最近作ったもの最近作ったもの
最近作ったものonozaty
 
Selenium入門
Selenium入門Selenium入門
Selenium入門onozaty
 
Redmineの画面をあなた好みにカスタマイズ - View customize pluginの紹介 - Redmine Japan 2020
Redmineの画面をあなた好みにカスタマイズ - View customize pluginの紹介 - Redmine Japan 2020Redmineの画面をあなた好みにカスタマイズ - View customize pluginの紹介 - Redmine Japan 2020
Redmineの画面をあなた好みにカスタマイズ - View customize pluginの紹介 - Redmine Japan 2020onozaty
 
「伝わるチケット」の書き方
「伝わるチケット」の書き方「伝わるチケット」の書き方
「伝わるチケット」の書き方onozaty
 
View customize plugin for Redmineの紹介 (2019年版)
View customize plugin for Redmineの紹介 (2019年版)View customize plugin for Redmineの紹介 (2019年版)
View customize plugin for Redmineの紹介 (2019年版)onozaty
 
View customize1.2.0の紹介
View customize1.2.0の紹介View customize1.2.0の紹介
View customize1.2.0の紹介onozaty
 
WebSocketでカメラの映像を共有してみた
WebSocketでカメラの映像を共有してみたWebSocketでカメラの映像を共有してみた
WebSocketでカメラの映像を共有してみたonozaty
 
Spring Bootを触ってみた
Spring Bootを触ってみたSpring Bootを触ってみた
Spring Bootを触ってみたonozaty
 
30歳過ぎてもエンジニアでいるためにやったこと
30歳過ぎてもエンジニアでいるためにやったこと30歳過ぎてもエンジニアでいるためにやったこと
30歳過ぎてもエンジニアでいるためにやったことonozaty
 
View customize pluginを使いこなす
View customize pluginを使いこなすView customize pluginを使いこなす
View customize pluginを使いこなすonozaty
 
View Customize Pluginで出来ること
View Customize Pluginで出来ることView Customize Pluginで出来ること
View Customize Pluginで出来ることonozaty
 
技術書のススメ
技術書のススメ技術書のススメ
技術書のススメonozaty
 
課題管理と情報共有のためのツール群
課題管理と情報共有のためのツール群課題管理と情報共有のためのツール群
課題管理と情報共有のためのツール群onozaty
 
お試し用のLinux環境を作る
お試し用のLinux環境を作るお試し用のLinux環境を作る
お試し用のLinux環境を作るonozaty
 

Plus de onozaty (20)

チームで開発するための環境を整える
チームで開発するための環境を整えるチームで開発するための環境を整える
チームで開発するための環境を整える
 
Selenium入門(2023年版)
Selenium入門(2023年版)Selenium入門(2023年版)
Selenium入門(2023年版)
 
40歳過ぎてもエンジニアでいるためにやっていること
40歳過ぎてもエンジニアでいるためにやっていること40歳過ぎてもエンジニアでいるためにやっていること
40歳過ぎてもエンジニアでいるためにやっていること
 
Java8から17へ
Java8から17へJava8から17へ
Java8から17へ
 
今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -
今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -
今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -
 
Redmine issue assign notice plugin の紹介
Redmine issue assign notice plugin の紹介Redmine issue assign notice plugin の紹介
Redmine issue assign notice plugin の紹介
 
最近作ったもの
最近作ったもの最近作ったもの
最近作ったもの
 
Selenium入門
Selenium入門Selenium入門
Selenium入門
 
Redmineの画面をあなた好みにカスタマイズ - View customize pluginの紹介 - Redmine Japan 2020
Redmineの画面をあなた好みにカスタマイズ - View customize pluginの紹介 - Redmine Japan 2020Redmineの画面をあなた好みにカスタマイズ - View customize pluginの紹介 - Redmine Japan 2020
Redmineの画面をあなた好みにカスタマイズ - View customize pluginの紹介 - Redmine Japan 2020
 
「伝わるチケット」の書き方
「伝わるチケット」の書き方「伝わるチケット」の書き方
「伝わるチケット」の書き方
 
View customize plugin for Redmineの紹介 (2019年版)
View customize plugin for Redmineの紹介 (2019年版)View customize plugin for Redmineの紹介 (2019年版)
View customize plugin for Redmineの紹介 (2019年版)
 
View customize1.2.0の紹介
View customize1.2.0の紹介View customize1.2.0の紹介
View customize1.2.0の紹介
 
WebSocketでカメラの映像を共有してみた
WebSocketでカメラの映像を共有してみたWebSocketでカメラの映像を共有してみた
WebSocketでカメラの映像を共有してみた
 
Spring Bootを触ってみた
Spring Bootを触ってみたSpring Bootを触ってみた
Spring Bootを触ってみた
 
30歳過ぎてもエンジニアでいるためにやったこと
30歳過ぎてもエンジニアでいるためにやったこと30歳過ぎてもエンジニアでいるためにやったこと
30歳過ぎてもエンジニアでいるためにやったこと
 
View customize pluginを使いこなす
View customize pluginを使いこなすView customize pluginを使いこなす
View customize pluginを使いこなす
 
View Customize Pluginで出来ること
View Customize Pluginで出来ることView Customize Pluginで出来ること
View Customize Pluginで出来ること
 
技術書のススメ
技術書のススメ技術書のススメ
技術書のススメ
 
課題管理と情報共有のためのツール群
課題管理と情報共有のためのツール群課題管理と情報共有のためのツール群
課題管理と情報共有のためのツール群
 
お試し用のLinux環境を作る
お試し用のLinux環境を作るお試し用のLinux環境を作る
お試し用のLinux環境を作る
 

Dernier

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 

Dernier (20)

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 

Lombokの紹介

  • 2. Lombok? • Java ( ) • • getter/setter • equals, hashCode • toString •
  • 3. Lombok? • @Getter @Setter public class Customer { private int id; private String name; } public class Customer { private int id; private String name; public int getId() { return this.id; } public String getName() { return this.name; } public void setId(final int id) { this.id = id; } public void setName(final String name) { this.name = name; } }
  • 5. • Lombok ( ) • IDE • Eclipse Lombok jar Eclipse ( )
  • 6. @Getter, @Setter • getter/setter • ( ) • ( public) • final setter ( )
  • 7. @Getter, @Setter public class GetterSetterExample { // @Getter @Setter private int id; // @Setter(AccessLevel.PROTECTED) private String name; } public class GetterSetterExample { private int id; private String name; public int getId() { return this.id; } public void setId(final int id) { this.id = id; } protected void setName(final String name) { this.name = name; } }
  • 9. @ToString @ToString public class ToStringExample { private int id; private String name; public String getName() { return name; } } // exclude @ToString(exclude = "name") class ToStringExample2 { private int id; private String name; } public class ToStringExample { private int id; private String name; public String getName() { return name; } @Override public String toString() { return "ToStringExample(id=" + this.id + ", name=" + this.getName() + ")"; } } class ToStringExample2 { private int id; private String name; @Override public String toString() { return "ToStringExample2(id=" + this.id + ")"; } }
  • 11. @EqualsAndHashCode @EqualsAndHashCode public class EqualsAndHashCodeExample { private int id; private String name; } // @EqualsAndHashCode(exclude = "age") class EqualsAndHashCodeExample2 { private int id; private String name; private int age; } public class EqualsAndHashCodeExample { private int id; private String name; @Override public boolean equals(final Object o) { … } @Override public int hashCode() { … } } public class EqualsAndHashCodeExample2 { private int id; private String name; private int age; // age @Override public boolean equals(final Object o) { … } @Override public int hashCode() { … } }
  • 13. @AllArgsConstructor, @NoArgsConstructor, @RequiredArgsConstructor @AllArgsConstructor @NoArgsConstructor public class ConstructorExample { private int id; private String name; } @RequiredArgsConstructor class ConstructorExample2 { private final int id; private String name; } public class ConstructorExample { private int id; private String name; public ConstructorExample( final int id, final String name) { this.id = id; this.name = name; } public ConstructorExample() { } } class ConstructorExample2 { private final int id; private String name; public ConstructorExample2(final int id) { this.id = id; } }
  • 14. @Data • • @ToString • @EqualsAndHashCode • @Getter • @Setter • @RequiredArgsConstructor •
  • 15. @Data @Data public class DataExample { private final int id; private String name; } public class DataExample { private final int id; private String name; public DataExample(final int id) { this.id = id; } public int getId() { return this.id; } public String getName() { return this.name; } public void setName(final String name) { this.name = name; } @Override public boolean equals(final Object o) { … } @Override public int hashCode() { … } @Override public String toString() { … } }
  • 16. @Value • final • @ToString • @EqualsAndHashCode • @Getter • @RequiredArgsConstructor • Immutable
  • 17. @Value @Value public class ValueExample { private int id; private String name; } public final class ValueExample { private final int id; private final String name; public ValueExample( final int id, final String name) { this.id = id; this.name = name; } public int getId() { return this.id; } public String getName() { return this.name; } @Override public boolean equals(final Object o) { … } @Override public int hashCode() { … } @Override public String toString() { … } }
  • 18. @Builder • Builder (GoF Effective Java ) Builder • Builder
  • 19. @Builder public static void main(String[] args) { // Builder ( ) Customer customer = new Customer( "Taro", "Yamada", "Tokyo", Arrays.asList("A", "B")); System.out.println(customer); } @AllArgsConstructor @ToString class Customer { private String firstName; private String lastName; private String city; private List<String> tags; } public static void main(String[] args) { // Builder Customer customer = Customer.builder() .firstName("Taro") .lastName("Yamada") .city("Tokyo") .tag("A") .tag("B") .build(); System.out.println(customer); } @Builder @ToString class Customer { private String firstName; private String lastName; private String city; @Singular private List<String> tags; }
  • 20. @Slf4j • log static Logger • Slf4j Apache commons log(@Log) • Logger
  • 21. @Slf4j @Slf4j public class LogExample { public static void main(String[] args) { log.info("main."); } } public class LogExample { private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LogExample.class); public static void main(String[] args) { log.info("main."); } }
  • 23. @NonNull @RequiredArgsConstructor public class NonNullExample { @NonNull private String name; public void printLength( @NonNull String message) { System.out.println( message.length()); } } public class NonNullExample { @NonNull private String name; public void printLength( @NonNull String message) { if (message == null) { throw new NullPointerException("message"); } System.out.println(message.length()); } public NonNullExample( @NonNull final String name) { if (name == null) { throw new NullPointerException("name"); } this.name = name; } }
  • 25. val public static void main(String[] args) { val list = new ArrayList<String>(); list.add("a"); list.add("b"); val item = list.get(0); System.out.println(item); } public static void main(String[] args) { final ArrayList<String> list = new ArrayList<String>(); list.add("a"); list.add("b"); final String item = list.get(0); System.out.println(item); }
  • 27. @Cleanup public static void main(String[] args) throws IOException { Path filePath = Paths.get(args[0]); @Cleanup BufferedReader reader = Files.newBufferedReader(filePath); System.out.println(reader.readLine()); } public static void main(String[] args) throws IOException { Path filePath = Paths.get(args[0]); BufferedReader reader = Files.newBufferedReader(filePath); try { System.out.println(reader.readLine()); } finally { if (Collections.singletonList(reader).get(0) != null) { reader.close(); } } }
  • 29. @Synchronized public class SynchronizedExample { @Synchronized public static void hello() { System.out.println("hello"); } @Synchronized public void bye() { System.out.println("bye"); } } public class SynchronizedExample { private static final Object $LOCK = new Object[0]; private final Object $lock = new Object[0]; public static void hello() { synchronized (SynchronizedExample.$LOCK) { System.out.println("hello"); } } public void bye() { synchronized (this.$lock) { System.out.println("bye"); } } }
  • 31. @SneakyThrows public class SneakyThrowsExample { @SneakyThrows public static void main(String[] args) { throw new Exception(); } } public class SneakyThrowsExample { public static void main(String[] args) { try { throw new Exception(); } catch (final Throwable $ex) { throw Lombok.sneakyThrow($ex); } } }
  • 32. delombok • delombok Lombok • delombok • https://projectlombok.org/features/delombok > java -jar lombok.jar delombok src -d src-delomboked
  • 33. • Lombok onMethd onParam • https://projectlombok.org/features/experimental/onX
  • 35. Lombok • • Lombok • Lombok Lombok • val @Cleanup @SneakyThrows (Lombok )