naver / arcus-java-client

ARCUS Java client
Apache License 2.0
50 stars 47 forks source link

FEATURE: Add DefaultArcusConnectionFactory class. #762

Closed uhm0311 closed 3 weeks ago

uhm0311 commented 5 months ago

๐Ÿ”— Related Issue

โŒจ๏ธ What I did

ArcusConnectionFactory ํด๋ž˜์Šค๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ๋Œ€๋ถ€๋ถ„์˜ ๊ตฌํ˜„์ด DefaultConnectionFactory์™€ ๊ฐ™์•„ DefaultConnectionFactory๋ฅผ ์ƒ์†๋ฐ›๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค.

static final ํ•„๋“œ ์ถ”๊ฐ€

๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ธฐ์ค€์œผ๋กœ ConnectionFactoryBuilder ํด๋ž˜์Šค์˜ ํ•„๋“œ ๊ธฐ๋ณธ๊ฐ’์„ ArcusConnectionFactory ํด๋ž˜์Šค ๋‚ด์— static final๋กœ ์„ ์–ธํ–ˆ์Šต๋‹ˆ๋‹ค.

๊ธฐ๋ณธ๊ฐ’์„ ๋ฆฌํ„ฐ๋Ÿด์—์„œ static final ํ•„๋“œ๋กœ ๋ณ€๊ฒฝ

ConnectionFactoryBuilder ํด๋ž˜์Šค์˜ ํ•„๋“œ ๊ธฐ๋ณธ๊ฐ’ ์ค‘ ๋ฆฌํ„ฐ๋Ÿด๋กœ ํ•˜๋“œ์ฝ”๋”ฉ ๋˜์–ด ์žˆ๋Š” ๊ฒฝ์šฐ ๋‚ด๋ถ€ ๋™์ž‘์ด ๋‹ฌ๋ผ์ง€์ง€ ์•Š๋Š” ์„ ์—์„œ static final ๊ฐ’์„ ์ฐธ์กฐํ•˜๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค. ๋งŒ์•ฝ ํ•„๋“œ์˜ ๊ธฐ๋ณธ๊ฐ’์œผ๋กœ ํ• ๋‹นํ•  static final ํ•„๋“œ๊ฐ€ ์—†๋‹ค๋ฉด ์ƒˆ๋กญ๊ฒŒ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹จ, ์•„๋ž˜์™€ ๊ฐ™์€ ๊ฒฝ์šฐ ๊ธฐ์กด๋Œ€๋กœ ๋ฆฌํ„ฐ๋Ÿด์„ ๊ธฐ๋ณธ๊ฐ’์œผ๋กœ ์‚ฌ์šฉํ•˜๋„๋ก ํ–ˆ์Šต๋‹ˆ๋‹ค.

ํ…Œ์ŠคํŠธ ์ฝ”๋“œ

ArcusConnectionFactory์™€ ๋‹ค์Œ์˜ ๋‘ ๊ฐ€์ง€๋ฅผ ๋น„๊ตํ•˜๋Š” ํ…Œ์ŠคํŠธ ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.

ํ–ฅํ›„ ๊ธฐ๋ณธ๊ฐ’์„ ์ž˜๋ชป ๋ณ€๊ฒฝํ–ˆ์„ ๋•Œ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ๋ฅผ ํ†ตํ•ด ์•Œ์•„์ฐจ๋ฆด ์ˆ˜ ์žˆ๋„๋ก Reflection์„ ์ด์šฉํ•˜์—ฌ ์„œ๋กœ ๋‹ค๋ฅธ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ˜ํ™˜ํ•ด์•ผ ํ•˜๋Š” ๋ฉ”์†Œ๋“œ๊ฐ€ ์•„๋‹ˆ๋ผ๋ฉด ๋™์ผํ•œ ๊ฐ’์ด ๋ฐ˜ํ™˜๋˜๋Š”์ง€ ๊ฒ€์ฆํ•˜๊ธฐ ๋•Œ๋ฌธ์— ํ…Œ์ŠคํŠธ ์ฝ”๋“œ๊ฐ€ ์—„๊ฒฉํ•ด ๋ณด์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹จ, ๋ฉ”์†Œ๋“œ๊ฐ€ Primitive Type๋„ ์•„๋‹ˆ๊ณ  String ํƒ€์ž…๋„ ์•„๋‹Œ ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ๊ฒฝ์šฐ Object.eqauls() ๋ฉ”์†Œ๋“œ๋ฅผ ๊ตฌํ˜„ํ•˜์ง€ ์•Š์€ ๊ฐ์ฒด๋Š” ๊ฐ’์„ ๋น„๊ตํ•  ์ˆ˜ ์—†์–ด ๋ฐ˜ํ™˜๋œ ๊ฐ์ฒด์˜ ๊ฐ’์ด ์•„๋‹Œ ํƒ€์ž…์ด ๋™์ผํ•œ์ง€ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค.

jhpark816 commented 3 weeks ago

@uhm0311 ์•„๋ž˜์™€ ๊ฐ™์ด wiki์— ConnectionFactory๋ฅผ ์ถฉ๋ถ„ํžˆ ์„ค๋ช…ํ•˜์˜€๊ณ , ConnectionFactoryBuider๋กœ ์›ํ•˜๋Š” ConnectionFactory ๋งŒ๋“ค ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ, DefaultArcusConnectionFactory๋Š” ์ถ”๊ฐ€ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ์œผ๋กœ ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.