Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Lombokハンズオン Javado #02
Search
Hiroto YAMAKAWA
October 04, 2015
Programming
0
380
Lombokハンズオン Javado #02
Java Doでしょう #02 (10/04,札幌)
Hiroto YAMAKAWA
October 04, 2015
Tweet
Share
More Decks by Hiroto YAMAKAWA
See All by Hiroto YAMAKAWA
Javaへの新たなHello, World / yuruchitose-04
gishi_yama
0
31
JSR381、知っていますか?Javaの画像認識APIのはなし / SC4Y23-05
gishi_yama
0
180
jPeekでのクラスの凝集度計測の試行 / mild-web-sapporo#24
gishi_yama
0
310
Github CopilotとChatGPTを使って感じた使い分けの糸口 / JavaDo #22
gishi_yama
1
1.3k
子ども向けプログラミング体験教室でのHololens2利用事例 / IoTLT#97
gishi_yama
0
87
AWS Serverless Java Container, Spring Bootで試してみた / javado22
gishi_yama
0
480
Hololens2と 小中高プログラミング教育の利用にむけた試行 / XRMTG 2023-1-18
gishi_yama
0
280
小学生がmicro:bitを用いて行える課題解決を意識した自由研究事例 /SC4Y '22#4
gishi_yama
0
380
あなたもこだわろう!Web開発環境 (物理編)'22 / mild-web-sapporo#22
gishi_yama
0
300
Other Decks in Programming
See All in Programming
みんなでプロポーザルを書いてみた
yuriko1211
0
260
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
120
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
620
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
130
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
Ethereum_.pdf
nekomatu
0
460
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.2k
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
KATA
mclloyd
29
14k
Become a Pro
speakerdeck
PRO
25
5k
The Language of Interfaces
destraynor
154
24k
Making Projects Easy
brettharned
115
5.9k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
Transcript
-PNCPLϋϯζΦϯ !HJTIJ@ZBNB IUUQTHJUIVCDPNKBWBEP @TFNJOBS
HJTIJ@ZBNB ઍࡀࢢͷେֶͰใγεςϜͷݚڀ։ൃʹैࣄͯ͠·͢ FϥʔχϯάγεςϜͱ͔ɺҬͷߦใϙʔλϧͱ͔ʜ "QBDIF8JDLFUͷυΩϡϝϯτ༁ ࡳຈͷ+BWBΤϯδχΞίϛϡχςΟʢ+BWB%Pʣ ͓͍͍͠ͷେ͖Ͱ͢ ͳͲΛͬͯ·͢
ࠓͷ༰
“Project Lombok makes java a spicier language by adding 'handlers'
that know how to build and compile simple, boilerplate-free, not- quite-java code.” 1SPKFDU-PNCPL IUUQTHJUIVCDPNS[XJUTFSMPPUMPNCPL LombokJavaʹ’ϋϯυϥ’ΛՃ͢Δ͜ͱͰɺJavaΛؾͷར͍ͨ ݴޠʹ͢ΔΑʂ ϋϯυϥ ɾγϯϓϧͰ ɾϘΠϥʔϓϨʔτʢ͓͖·Γͷॻ͖ํʣΛ·͵͕ΕΔ ɾJavaͬΆ͘ͳ͍ ίʔυʹ͢ΔϏϧυίϯύΠϧͷํ๏ΛѲ͍ͯ͠ΔͷͩΑʂ
public class Cat { private static final Logger
log = LoggerFactory.getLogger(Cat.class); private String name; private String voice; private int age; public Cat() { this(null, null, 0); } public Cat(String name, String voice, int age) { this.name = name; this.voice = voice; this.age = age; } public void setName(String name) { this.name = name; } public String getName() { return name; } // ҎԼུ… ຖճ࡞͢Δ ͓͖·Γͷίʔυ ʢϘΠϥʔϓϨʔτʣ *%&Ͱ͋ΔఔੜͰ͖Δͷ͋Δ͕ɺ໘ͳ͜ͱ͋ΔΑ
ͨͱ͑ w (FUUFS4FUUFS w FRVBMT IBTIDPEF w σϑΥϧτҾ͖ ίϯετϥΫλ w
5P4USJOH w OVMMDIFDL w #VJMEFSύλʔϯ w -PHHFS w มఆٛ w *NNVUBCMF0CKFDU w ԆॳظԽ w FUDʜ -PNCPL͜͏͍ͬͨͷΛΞϊςʔγϣϯͰলུɾઃఆ͢ΔΑ
ͭ·Γɺ-PNCPLΛ͏ͱʜ ఆܕίʔυ͕૿͕͑ͪͳ෦ ʢσʔλɾόϦϡʔΦϒδΣΫτσβΠϯύλʔϯʣ ͷهࡌΛΞϊςʔγϣϯͰ؆ུԽͰ͖ΔΑ ͔Βެ։͞Ε͓ͯΓɺ ຊޠͷใ͔ͳΓॆ࣮͍ͯ͠ΔΑ ͠ձͰ͍ͬͯΔํ͕͍Εϊϋͱ͔ ͬͯΔײΛͲ͠Ͳ͠ڞ༗ͯ͠΄͍͠Α
-PNCPLͷ͘͠Έ
public class Cat { private String name;
public void setName(String name) { this.name = name; } public String getName() { return name; } } import lombok.Getter; import lombok.Setter; @Getter @Setter public class Cat { // ΞϊςʔγϣϯΛ͚ͭΔͱgetName(), setName(String name) ͕࣮͞ΕΔ private String name; } -PNCPLΛ͏ͱʜ
ˑ؝ٝػ؎ٕ儗ךؙٓأػأח-PNCPLָろתגְהծ؝ٝػ؎ ٕ儗ח-PNCPLָⰅ⸂ا٦أؿ؋؎ٕ鍑匿׃ג㹀㘗؝٦س欰 䧭׃䖓ծ؝ٝػ؎ٓח床׃תׅկ⚥殛䖞גծا٦أ؝٦سٖ كٕדכHFUUFSTFUUFSָ㶷㖈׃זֻגծؙٓأؿ؋؎ٕغ ؎ز؝٦سٖكٕדכHFUUFSTFUUFSָ㶷㖈ׅךדׅկ˒ )"46/6.",FOKJ 铩侄ִגֻזַ-PNCPLךֿה IUUQXXXDPQQFSNJOFKQEPDTQSPHSBNNJOHMPNCPLIUNM
None
ϋϯζΦϯ
ਐΊํ TSDNBJOKBWBKBWBEPIBOET0OWBOJMMB ͷ֤ΫϥεΛ։͖ɺࢦࣔ௨Γʹॻ͖͔͍͑ͯ͘ ʢݱঢ়ͷ-PNCPLΞϊςʔγϣϯΛ͓͓ΉͶཏ͍ͯ͠·͢ʣ TSDNBJOKBWBKBWBEPIBOET0OVTF-PNCPL ͷΫϥε͕ൣղతͳίʔυ TSDNBJOKBWBTBNQMFɺ ࣮ࡍʹ͏ͱʜײͷࢀߟʹ͍ͯͩ͘͠͞
ͳͷͰ ͍͔ͭ͘ൈਮͯ͠ ϋϯζΦϯ͠·͢ʂ
(FUUFS4FUUFS ʢ)BOET0Oʣ
!(FUUFS !4FUUFS QVCMJDDMBTT)BOET0O\ QSJWBUFTUBUJDOBM-PHHFSMPH -PHHFS'BDUPSZHFU-PHHFS )BOET0ODMBTT QSJWBUF4USJOHJOGP QVCMJDTUBUJDWPJENBJO 4USJOH<>BSHT
\ )BOET0OUBSHFUOFX)BOET0O UBSHFUTFU*OGP 䧭⸆ MPHJOGP UBSHFUHFU*OGP ^ ^ ͜ͷଞɺ(FUUFSͷεϨουηʔϑͳԆॳظԽ(FUUFSͳͲՄೳ ʢྫɿ)BOET0Oʣ (FUUFS4FUUFS͕࡞͞Εར༻Ͱ͖Δʂ
/VMMνΣοΫ ʢ)BOET0OBʣ
!(FUUFS !4FUUFS QVCMJDDMBTT)BOET0OB\ QSJWBUFTUBUJDOBM-PHHFSMPH -PHHFS'BDUPSZHFU-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MEFSύλʔϯ ʢ)BOET0Oʣ
!4MGK !5P4USJOH !#VJMEFS QVCMJDDMBTT)BOET0O\ QSJWBUF4USJOHOBNF !4JOHVMBS QSJWBUF-JTU4USJOHTFNJOBST QVCMJDTUBUJDWPJENBJO 4USJOH<>BSHT \
)BOET0O#VJMEFSCVJMEFS)BOET0OCVJMEFS )BOET0OUBSHFSCVJMEFSOBNF +BWB%P TFNJOBS "QBDIF8JDLFU TFNJOBS 4USFBN-BNCEB TFNJOBS XBLF TFNJOBS MPNCPL CVJME MPHJOGP UBSHFSUP4USJOH ^ !#VJMEFSΛ͚ͭΔ͚ͩͰ #VJMEFSύλʔϯΛ࣮Մೳʂ !4JOHVMBS$PMMFDUJPOมΛ ݸͣͭՃͰ͖ΔΑ͏ʹ͢Δ
ͦͷ΄͔
w !6UJMJUZ$MBTT ΠϯελϯεԽͷ੍ʢ)BOET0Oʣ w !$MFBOVQ $MPTBCMFͳΦϒδΣΫτͷࣗಈDMPTFʢ)BOET0Oʣ w !4ZODISPOJ[FE ฒྻॲཧ༻ͷTZODISPOJ[FEϒϩοΫ࡞ʢ)BOET0Oʣ w
!8JUI JNNVUBCMFΦϒδΣΫτ༻ͷXJUIϝιου࡞ʢ)BOET0Oʣ w !"DDFTTPST HFUUFSTFUUFSͷϝιουνΣʔϯԽɺ'MVFOUΠϯλʔϑΣʔε తͳ໊শઃఆʢ)BOET0Oʣ
ͱ͜ΖͰ
-PNCPLΛ ࠇຐज़ͱ͍͏ਓଟ͍ʜʜ
ݸਓతʹࠇຐज़ײ͕ڧ͍ͱࢥ͏ͷ w !&YUFOTJPO.FUIPE มͷܕΛΩʔʹͨ͠TUBUJDϝιουͷมͷ݁߹ʢ)BOET0Oʣ w !%FMFHBUF ϝιουॲཧͷϑΟʔϧυΦϒδΣΫτͷҕৡʢ)BOET0Oʣ w !4OFBLZ5ISPXT
νΣοΫྫ֎ͷඇνΣοΫྫ֎Խʢ)BOET0Oʣ w !)FMQFS ϔϧύʔΫϥεͷΠϯελϯεԽলུʢ)BOET0Oʣ w PO)PHF!@@ !1JZP Ξϊςʔγϣϯͷ༩ʢ)BOET0Oʣ
ܹਏΑΓ தਏɾਏޱ͋ͨΓͰ ੍ޚͯͬͨ͠ํ͕ ΦΠγΠʂ
උߟ w -PNCPLΞϊςʔγϣϯͰੜ͞ΕΔίʔυͱ ࣮ࡍʹϓϩάϥϜ͞Εͨίʔυ͕ඃͬͨͱ͖ɺ ݪଇɺϓϩάϥϜ͞Εͨίʔυ͕༏ઌ͞ΕΔ w MPNCPLFYQFSJNFOUBMύοέʔδʹଘࡏ͢Δͷɺ ެࣜݟղʹςετ൛ʢ͑ͳ͍Θ͚Ͱͳ͍ʣ w
*%&ͱ͔Έ߹Θ͕ͤѱ͍෦Ͳ͏ͯ͋͠Δ ʢWBM͕ಛʹτϥϒΔײʣ
·ͱΊ -PNCPLΛར༻͢Δ͜ͱͰɺ+BWBͷϘΠϥʔϓϨʔτͳίʔυ ͷ؆ུԽʢίʔυྔͷݮগɺه๏౷ҰʹΑΔϛεͷܰݮʣΛૂ ͑Δɻ #FBOͳͲͷσʔλΦϒδΣΫτɺόϦϡʔΦϒδΣΫτͷੜ ɺσβΠϯύλʔϯͷ࣮ʹޮՌΛൃش͍͢͠ɻ *%&ͱͷ૬ੑɺҰׅมػೳͳͲͱͷτϨʔυΦϑඞཁɻ ҆ఆͯ͑͠ΔΞϊςʔγϣϯ͔Βͷಋೖ͕Φεεϝɻ ࠇຐज़తͳॴɺࠞཚͦ͠͏ͳॴແཧͤͣʹɻ
࣍ճ༧ࠂ 4QSJOH#PPUຊͱ͔ +6OJU࣮ફೖຊͱ͔ ڭՊॻʹͨ͠ ϋϯζΦϯͱ͔ʜʁ