SlideShare ist ein Scribd-Unternehmen logo
1 von 12
Problems of the Industry
 Boiler Plate Code
  Syntax Verbosity
 Non Standardization
  Not following the standard code conventions!!
 Human Error/Dependency
  Repeatable things (defining Getters, Setters etc.)
Demo Video

 Taken from http://projectlombok.org/

 Gives an idea what Project Lombok is and how it
 can be installed.

 Simple Demo of few Features.
Features
@Getter, @Setter, @ToString, @EqualsAndHashCode, @Data
@NoArgsConstructor, @RequiredArgsConstructor and
@AllArgsConstructor
@Cleanup, @Synchronized
@Log
@Delegate
val
@Getter and @Setter
 Automatic Generation of getters and setters.
 Method will be public unless you explicitly specify an
 AccessLevel
 @Getter and/or @Setter annotation on class
 Disable getter/setter generation for any field by using
 the special AccessLevel.NONE
 @NotNull for nullity check
 Demo
@ToString
Generates a default implementation of the toString()
method

Parameters 




Demo
@EqualsAndHashCode
Generates hashCode and equals implementations from
the fields (non-static, non-transient)

Parameters 




Demo
Constructor level Annotations

@NoArgsConstructor, @RequiredArgsConstructor, @AllA
rgsConstructor

Generates constructors that take no arguments, one
argument per final / non-null field, or one argument for
every field.

Specialized constructor can be made. Compile-time error
in case of any conflicts.

Demo
@Data
All together now: A shortcut for
@ToString, @EqualsAndHashCode, @Getter on all
fields, @Setter on all non-final fields, and
@RequiredArgsConstructor

Included annotations with changed parameters can be
defined along with @Data
@Cleanup
Automatic resource management: Call your close() methods
safely with no hassle.
Example: @Cleanup InputStream in = new
FileInputStream("some/file");
If the type of object you'd like to cleanup does not have a
close() method, but some other no-argument method like
dispose() so write it as
@Cleanup("dispose") TestClass t = new TestClass();
Logger Annotations!
Generate a logger field with name “log”

Four options
 @CommonsLog
 @Log
 @Log4j
 @Slf4j
And Lot More!!!
Some other supported features like
@Delegate, @Synchronized, val etc.

More to come soon!

Open Source

Details can be found at http://projectlombok.org/

Weitere ähnliche Inhalte

Was ist angesagt?

Clean Code II - Dependency Injection
Clean Code II - Dependency InjectionClean Code II - Dependency Injection
Clean Code II - Dependency Injection
Theo Jungeblut
 
ExcelとPythonによる社会インフラシステムの設定ファイルの自動生成
ExcelとPythonによる社会インフラシステムの設定ファイルの自動生成ExcelとPythonによる社会インフラシステムの設定ファイルの自動生成
ExcelとPythonによる社会インフラシステムの設定ファイルの自動生成
Fuminobu TAKEYAMA
 

Was ist angesagt? (20)

バッチは地味だが役に立つ
バッチは地味だが役に立つバッチは地味だが役に立つ
バッチは地味だが役に立つ
 
Monitoring, Logging and Tracing on Kubernetes
Monitoring, Logging and Tracing on KubernetesMonitoring, Logging and Tracing on Kubernetes
Monitoring, Logging and Tracing on Kubernetes
 
Open Liberty: オープンソースになったWebSphere Liberty
Open Liberty: オープンソースになったWebSphere LibertyOpen Liberty: オープンソースになったWebSphere Liberty
Open Liberty: オープンソースになったWebSphere Liberty
 
Red Hat OpenShift Container Storage
Red Hat OpenShift Container StorageRed Hat OpenShift Container Storage
Red Hat OpenShift Container Storage
 
Java 8-streams-collectors-patterns
Java 8-streams-collectors-patternsJava 8-streams-collectors-patterns
Java 8-streams-collectors-patterns
 
Exploring the power of OpenTelemetry on Kubernetes
Exploring the power of OpenTelemetry on KubernetesExploring the power of OpenTelemetry on Kubernetes
Exploring the power of OpenTelemetry on Kubernetes
 
Introduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesIntroduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examples
 
Java Virtual Machine, Call stack, Java Byte Code
Java Virtual Machine, Call stack, Java Byte CodeJava Virtual Machine, Call stack, Java Byte Code
Java Virtual Machine, Call stack, Java Byte Code
 
GraalVm and Quarkus
GraalVm and QuarkusGraalVm and Quarkus
GraalVm and Quarkus
 
JAVA_HOME/binにあるコマンド、いくつ使っていますか?[JVM関連ツール編](JJUGナイトセミナー「Java解析ツール特集」 発表資料)
JAVA_HOME/binにあるコマンド、いくつ使っていますか?[JVM関連ツール編](JJUGナイトセミナー「Java解析ツール特集」 発表資料)JAVA_HOME/binにあるコマンド、いくつ使っていますか?[JVM関連ツール編](JJUGナイトセミナー「Java解析ツール特集」 発表資料)
JAVA_HOME/binにあるコマンド、いくつ使っていますか?[JVM関連ツール編](JJUGナイトセミナー「Java解析ツール特集」 発表資料)
 
What's new in Spring Batch 5
What's new in Spring Batch 5What's new in Spring Batch 5
What's new in Spring Batch 5
 
Clean Code II - Dependency Injection
Clean Code II - Dependency InjectionClean Code II - Dependency Injection
Clean Code II - Dependency Injection
 
Bytecode Manipulation with a Java Agent and Byte Buddy
Bytecode Manipulation with a Java Agent and Byte BuddyBytecode Manipulation with a Java Agent and Byte Buddy
Bytecode Manipulation with a Java Agent and Byte Buddy
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
今こそ知りたいSpring Batch(Spring Fest 2020講演資料)
今こそ知りたいSpring Batch(Spring Fest 2020講演資料)今こそ知りたいSpring Batch(Spring Fest 2020講演資料)
今こそ知りたいSpring Batch(Spring Fest 2020講演資料)
 
JavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesJavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for Dummies
 
オススメのJavaログ管理手法 ~コンテナ編~(Open Source Conference 2022 Online/Spring 発表資料)
オススメのJavaログ管理手法 ~コンテナ編~(Open Source Conference 2022 Online/Spring 発表資料)オススメのJavaログ管理手法 ~コンテナ編~(Open Source Conference 2022 Online/Spring 発表資料)
オススメのJavaログ管理手法 ~コンテナ編~(Open Source Conference 2022 Online/Spring 発表資料)
 
最適なOpenJDKディストリビューションの選び方 #codetokyo19B3 #ccc_l5
最適なOpenJDKディストリビューションの選び方 #codetokyo19B3 #ccc_l5最適なOpenJDKディストリビューションの選び方 #codetokyo19B3 #ccc_l5
最適なOpenJDKディストリビューションの選び方 #codetokyo19B3 #ccc_l5
 
ExcelとPythonによる社会インフラシステムの設定ファイルの自動生成
ExcelとPythonによる社会インフラシステムの設定ファイルの自動生成ExcelとPythonによる社会インフラシステムの設定ファイルの自動生成
ExcelとPythonによる社会インフラシステムの設定ファイルの自動生成
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 

Andere mochten auch

阿里自研数据库 Ocean base实践
阿里自研数据库 Ocean base实践阿里自研数据库 Ocean base实践
阿里自研数据库 Ocean base实践
drewz lin
 
社内Java8勉強会 ラムダ式とストリームAPI
社内Java8勉強会 ラムダ式とストリームAPI社内Java8勉強会 ラムダ式とストリームAPI
社内Java8勉強会 ラムダ式とストリームAPI
Akihiro Ikezoe
 
High and low context cultures relationships in each
High and low context cultures relationships in eachHigh and low context cultures relationships in each
High and low context cultures relationships in each
Krystal Kelly
 
ほんとうに便利だった業務で使えるJava SE8新機能(JJUG CCC 2015 Spring)
ほんとうに便利だった業務で使えるJava SE8新機能(JJUG CCC 2015 Spring)ほんとうに便利だった業務で使えるJava SE8新機能(JJUG CCC 2015 Spring)
ほんとうに便利だった業務で使えるJava SE8新機能(JJUG CCC 2015 Spring)
Yuuki Fukuda
 

Andere mochten auch (14)

Lombok ハンズオン
Lombok ハンズオンLombok ハンズオン
Lombok ハンズオン
 
Lombok island-Indonesia
Lombok island-IndonesiaLombok island-Indonesia
Lombok island-Indonesia
 
Lombokのススメ
LombokのススメLombokのススメ
Lombokのススメ
 
阿里自研数据库 Ocean base实践
阿里自研数据库 Ocean base实践阿里自研数据库 Ocean base实践
阿里自研数据库 Ocean base实践
 
Wicket体験談
Wicket体験談Wicket体験談
Wicket体験談
 
Wicket 2010
Wicket 2010Wicket 2010
Wicket 2010
 
Java初心者がJava8のラムダ式をやってみた
Java初心者がJava8のラムダ式をやってみたJava初心者がJava8のラムダ式をやってみた
Java初心者がJava8のラムダ式をやってみた
 
Spring bootでweb セキュリティ(ログイン認証)編
Spring bootでweb セキュリティ(ログイン認証)編Spring bootでweb セキュリティ(ログイン認証)編
Spring bootでweb セキュリティ(ログイン認証)編
 
社内Java8勉強会 ラムダ式とストリームAPI
社内Java8勉強会 ラムダ式とストリームAPI社内Java8勉強会 ラムダ式とストリームAPI
社内Java8勉強会 ラムダ式とストリームAPI
 
High and low context cultures relationships in each
High and low context cultures relationships in eachHigh and low context cultures relationships in each
High and low context cultures relationships in each
 
入門Ansible
入門Ansible入門Ansible
入門Ansible
 
ほんとうに便利だった業務で使えるJava SE8新機能(JJUG CCC 2015 Spring)
ほんとうに便利だった業務で使えるJava SE8新機能(JJUG CCC 2015 Spring)ほんとうに便利だった業務で使えるJava SE8新機能(JJUG CCC 2015 Spring)
ほんとうに便利だった業務で使えるJava SE8新機能(JJUG CCC 2015 Spring)
 
こわくない Git
こわくない Gitこわくない Git
こわくない Git
 
いつやるの?Git入門
いつやるの?Git入門いつやるの?Git入門
いつやるの?Git入門
 

Ähnlich wie Project Lombok!

Whats New in MSBuild 3.5 and Team Build 2008
Whats New in MSBuild 3.5 and Team Build 2008Whats New in MSBuild 3.5 and Team Build 2008
Whats New in MSBuild 3.5 and Team Build 2008
wbarthol
 

Ähnlich wie Project Lombok! (20)

OpenDaylight Developer Experience 2.0
 OpenDaylight Developer Experience 2.0 OpenDaylight Developer Experience 2.0
OpenDaylight Developer Experience 2.0
 
Best Practices In Implementing Container Image Promotion Pipelines
Best Practices In Implementing Container Image Promotion PipelinesBest Practices In Implementing Container Image Promotion Pipelines
Best Practices In Implementing Container Image Promotion Pipelines
 
Mock your way with Mockito
Mock your way with MockitoMock your way with Mockito
Mock your way with Mockito
 
Unit testing - A&BP CC
Unit testing - A&BP CCUnit testing - A&BP CC
Unit testing - A&BP CC
 
Stopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under TestStopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under Test
 
System verilog important
System verilog importantSystem verilog important
System verilog important
 
Legacy Dependency Kata v2.0
Legacy Dependency Kata v2.0Legacy Dependency Kata v2.0
Legacy Dependency Kata v2.0
 
Journey to JavaScript (from C#)
Journey to JavaScript (from C#)Journey to JavaScript (from C#)
Journey to JavaScript (from C#)
 
WebTest - Efficient Functional Web Testing with HtmlUnit and Beyond
WebTest - Efficient Functional Web Testing with HtmlUnit and BeyondWebTest - Efficient Functional Web Testing with HtmlUnit and Beyond
WebTest - Efficient Functional Web Testing with HtmlUnit and Beyond
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Whats New in MSBuild 3.5 and Team Build 2008
Whats New in MSBuild 3.5 and Team Build 2008Whats New in MSBuild 3.5 and Team Build 2008
Whats New in MSBuild 3.5 and Team Build 2008
 
081107 Sammy Eclipse Summit2
081107   Sammy   Eclipse Summit2081107   Sammy   Eclipse Summit2
081107 Sammy Eclipse Summit2
 
Mockito with a hint of PowerMock
Mockito with a hint of PowerMockMockito with a hint of PowerMock
Mockito with a hint of PowerMock
 
TDoc - Bringing Documentation to Tool
TDoc - Bringing Documentation to ToolTDoc - Bringing Documentation to Tool
TDoc - Bringing Documentation to Tool
 
JMockit Framework Overview
JMockit Framework OverviewJMockit Framework Overview
JMockit Framework Overview
 
Mastering Mock Objects - Advanced Unit Testing for Java
Mastering Mock Objects - Advanced Unit Testing for JavaMastering Mock Objects - Advanced Unit Testing for Java
Mastering Mock Objects - Advanced Unit Testing for Java
 
Old code doesn't stink
Old code doesn't stinkOld code doesn't stink
Old code doesn't stink
 
Getting start Java EE Action-Based MVC with Thymeleaf
Getting start Java EE Action-Based MVC with ThymeleafGetting start Java EE Action-Based MVC with Thymeleaf
Getting start Java EE Action-Based MVC with Thymeleaf
 
Rise of the Machines - Automate your Development
Rise of the Machines - Automate your DevelopmentRise of the Machines - Automate your Development
Rise of the Machines - Automate your Development
 
Grails 1.1 Testing - Unit, Integration & Functional
Grails 1.1 Testing - Unit, Integration & FunctionalGrails 1.1 Testing - Unit, Integration & Functional
Grails 1.1 Testing - Unit, Integration & Functional
 

Kürzlich hochgeladen

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Kürzlich hochgeladen (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

Project Lombok!

  • 1.
  • 2. Problems of the Industry Boiler Plate Code Syntax Verbosity Non Standardization Not following the standard code conventions!! Human Error/Dependency Repeatable things (defining Getters, Setters etc.)
  • 3. Demo Video Taken from http://projectlombok.org/ Gives an idea what Project Lombok is and how it can be installed. Simple Demo of few Features.
  • 4. Features @Getter, @Setter, @ToString, @EqualsAndHashCode, @Data @NoArgsConstructor, @RequiredArgsConstructor and @AllArgsConstructor @Cleanup, @Synchronized @Log @Delegate val
  • 5. @Getter and @Setter Automatic Generation of getters and setters. Method will be public unless you explicitly specify an AccessLevel @Getter and/or @Setter annotation on class Disable getter/setter generation for any field by using the special AccessLevel.NONE @NotNull for nullity check Demo
  • 6. @ToString Generates a default implementation of the toString() method Parameters  Demo
  • 7. @EqualsAndHashCode Generates hashCode and equals implementations from the fields (non-static, non-transient) Parameters  Demo
  • 8. Constructor level Annotations @NoArgsConstructor, @RequiredArgsConstructor, @AllA rgsConstructor Generates constructors that take no arguments, one argument per final / non-null field, or one argument for every field. Specialized constructor can be made. Compile-time error in case of any conflicts. Demo
  • 9. @Data All together now: A shortcut for @ToString, @EqualsAndHashCode, @Getter on all fields, @Setter on all non-final fields, and @RequiredArgsConstructor Included annotations with changed parameters can be defined along with @Data
  • 10. @Cleanup Automatic resource management: Call your close() methods safely with no hassle. Example: @Cleanup InputStream in = new FileInputStream("some/file"); If the type of object you'd like to cleanup does not have a close() method, but some other no-argument method like dispose() so write it as @Cleanup("dispose") TestClass t = new TestClass();
  • 11. Logger Annotations! Generate a logger field with name “log” Four options @CommonsLog @Log @Log4j @Slf4j
  • 12. And Lot More!!! Some other supported features like @Delegate, @Synchronized, val etc. More to come soon! Open Source Details can be found at http://projectlombok.org/

Hinweis der Redaktion

  1. @Getter / @SetterNever write public intgetFoo() {return foo;} again.@ToStringNo need to start a debugger to see your fields: Just let lombok generate a toString for you!@EqualsAndHashCodeEquality made easy: Generates hashCode and equals implementations from the fields of your object.@DataAll together now: A shortcut for @ToString, @EqualsAndHashCode, @Getter on all fields, and @Setter on all non-final fields, and @RequiredArgsConstructor!@NoArgsConstructor, @RequiredArgsConstructor and @AllArgsConstructorConstructors made to order: Generates constructors that take no arguments, one argument per final / non-null field, or one argument for every field.@CleanupAutomatic resource management: Call your close() methods safely with no hassle.@Synchronizedsynchronized done right: Don't expose your locks.@LogCaptain's Log, stardate 24435.7: "What was that line again?"@DelegateDon't lose your composition.valFinally! Hassle-free final local variables.