๐Ÿ“š Language/Java

email๊ณผ userEmail์€ ๋ถ„๋ช…ํžˆ ๊ฐ™์€ ๊ฐ’์ธ๋ฐ .. == ์—ฐ์‚ฐ์ž๋ฅผ ์‚ฌ์šฉํ–ˆ์„ ๋•Œ ๊ฐ™๋‹ค๋Š” ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜์˜ค์ง€ ์•Š์•˜๋‹ค. ๋””๋ฒ„๊ฑฐ๋ฅผ ํ†ตํ•ด์„œ๋„ ๊ฐ™์€ ๊ฐ’์ด๊ณ  ํ„ฐ๋ฏธ๋„์— ์ถœ๋ ฅํ•ด๋ดค์–ด๋„ ๊ฐ™์€ ๊ฐ’์ธ๋ฐ if๋ฌธ์— ๊ฑธ๋ฆฌ์ง€ ์•Š์•˜๋‹ค. Java์˜ ๋ฌธ์ž์—ด ๋น„๊ต ๋ฐฉ์‹ ๋•Œ๋ฌธ์ด์—ˆ๋‹ค. == ์—ฐ์‚ฐ์ž์™€ equals() ์—ฐ์‚ฐ์ž์˜ ์ฐจ์ด Java์—์„œ ๋ฌธ์ž์—ด์„ ๋น„๊ตํ•  ๋•Œ, == ์—ฐ์‚ฐ์ž๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋‘ ๋ฌธ์ž์—ด ๊ฐ์ฒด์˜ ์ฐธ์กฐ๊ฐ€ ๊ฐ™์€์ง€๋ฅผ ๋น„๊ตํ•œ๋‹ค. ๋ฌธ์ž์—ด์˜ ๋‚ด์šฉ์ด ๊ฐ™๋”๋ผ๋„, ๋‹ค๋ฅธ ๊ฐ์ฒด์ผ ๊ฒฝ์šฐ false๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ๋”ฐ๋ผ์„œ, ๋ฌธ์ž์—ด์˜ ๋‚ด์šฉ์„ ๋น„๊ตํ•  ๋•Œ๋Š” .equals() ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค! log.info(email); log.info(userEmail); if (email.equals(userEmail) && UrlDao.getUrl(urlHash)...
Lombok ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” ์ž๋ฐ” ๊ฐœ๋ฐœ์„ ๋” ํšจ์œจ์ ์ด๊ณ  ๊ฐ„๊ฒฐํ•˜๊ฒŒ ๋งŒ๋“œ๋Š” ๋ฐ ๋„์›€์„ ์ฃผ๋Š” ๋„๊ตฌ์ด๋‹ค. ์ด ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์˜ ์ฃผ์š” ๋ชฉ์ ์€ ์ž๋ฐ” ์†Œ์Šค์ฝ”๋“œ์—์„œ ๋ฐ˜๋ณต๋˜๋Š” ๋ณด์ผ๋Ÿฌํ”Œ๋ ˆ์ดํŠธ ์ฝ”๋“œ๋ฅผ ์ค„์ด๋Š” ๊ฒƒ์ด๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, getter, setter, toString, equals, hashCode์™€ ๊ฐ™์€ ๋ฉ”์†Œ๋“œ๋ฅผ ์–ด๋…ธํ…Œ์ด์…˜์„ ์‚ฌ์šฉํ•˜์—ฌ ์ž๋™์œผ๋กœ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค. Lombok์€ ์ปดํŒŒ์ผ ์‹œ๊ฐ„์— ์ž‘๋™ํ•˜์—ฌ ์†Œ์Šค ์ฝ”๋“œ์— ์ฃผ์ž…๋œ๋‹ค. ์ด๋Š” ๋Ÿฐํƒ€์ž„์— ์ถ”๊ฐ€์ ์ธ ์˜ค๋ฒ„ํ—ค๋“œ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š์Œ์„ ์˜๋ฏธํ•œ๋‹ค. ์ฃผ๋กœ ์‚ฌ์šฉ๋˜๋Š” ์–ด๋…ธํ…Œ์ด์…˜์€ @Data, @Getter, @Setter, @NoArgsConstructor, @AllArgsConstructor, @Builder ๋“ฑ์ด ์žˆ๋‹ค. ์ด๋“ค์€ ๊ฐ๊ฐ ํด๋ž˜์Šค์— ํ•„์š”ํ•œ ๊ธฐ๋ณธ์ ์ธ ๋ฉ”์†Œ๋“œ๋“ค์„ ์ž๋™์œผ๋กœ ์ƒ์„ฑํ•ด์ค€๋‹ค. Lom..
info != null: ์ด ์กฐ๊ฑด์€ info ๋ณ€์ˆ˜๊ฐ€ null์ธ์ง€ ์•„๋‹Œ์ง€๋ฅผ ๊ฒ€์‚ฌ **null์€ ๋ณ€์ˆ˜๊ฐ€ ์•„๋ฌด๋Ÿฐ ๊ฐ์ฒด๋„ ์ฐธ์กฐํ•˜์ง€ ์•Š๊ณ  ์žˆ์Œ์„ ์˜๋ฏธํ•จ** ๊ฐ์ฒด๊ฐ€ null์ธ ๊ฒฝ์šฐ, ํ•ด๋‹น ๊ฐ์ฒด์˜ ์–ด๋– ํ•œ ๋ฉ”์†Œ๋“œ๋„ ํ˜ธ์ถœํ•  ์ˆ˜ ์—†์œผ๋ฉฐ, ์ด๋ฅผ ์‹œ๋„ํ•  ๊ฒฝ์šฐ NullPointerException์ด ๋ฐœ์ƒํ•จ ๋”ฐ๋ผ์„œ info๊ฐ€ null์ด ์•„๋‹Œ ๊ฒฝ์šฐ์—๋งŒ ๋ฉ”์†Œ๋“œ ํ˜ธ์ถœ์ด๋‚˜ ์†์„ฑ ์ ‘๊ทผ์„ ์‹œ๋„ํ•ด์•ผ ํ•œ๋‹ค. !info.isEmpty(): ์ด ์กฐ๊ฑด์€ info ๋ฌธ์ž์—ด์ด ๋น„์–ด ์žˆ์ง€ ์•Š์€์ง€๋ฅผ ๊ฒ€์‚ฌ isEmpty() ๋ฉ”์†Œ๋“œ๋Š” ๋ฌธ์ž์—ด์ด ๋นˆ ๋ฌธ์ž์—ด์ธ์ง€ ํ™•์ธํ•˜๋ฉฐ, ๋นˆ ๋ฌธ์ž์—ด("")์ธ ๊ฒฝ์šฐ true๋ฅผ ๋ฐ˜ํ™˜ํ•จ !info.isEmpty()๋Š” info๊ฐ€ ๋นˆ ๋ฌธ์ž์—ด์ด ์•„๋‹Œ ๊ฒฝ์šฐ์— true๊ฐ€ ๋จ ๋นˆ ๋ฌธ์ž์—ด์ด ์•„๋‹ˆ๋ผ๋Š” ๊ฒƒ์€, ๋ฌธ์ž์—ด์ด ์ ์–ด๋„ ํ•˜๋‚˜ ์ด์ƒ์˜ ๋ฌธ์ž๋ฅผ ํฌํ•จํ•˜๊ณ ..
yesolz
'๐Ÿ“š Language/Java' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก