{"id":10412,"date":"2020-10-10T19:17:36","date_gmt":"2020-10-10T10:17:36","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=10412"},"modified":"2020-10-25T09:21:02","modified_gmt":"2020-10-25T00:21:02","slug":"adapter-%ed%8c%a8%ed%84%b4","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=10412","title":{"rendered":"[GoF] Adapter \ud328\ud134"},"content":{"rendered":"<h4>\ud328\ud134\uba85\uce6d<\/h4>\n<p>Adapter<\/p>\n<h4>\ud544\uc694\ud55c \uc0c1\ud669<\/h4>\n<p>\uc774\ubbf8 \ub9cc\ub4e4\uc5b4\uc838 \uc81c\uacf5\ub418\ub294 \ud074\ub798\uc2a4 \ub610\ub294 API\uac00 \uc218\uc815\ud560 \uc218 \uc5c6\uac70\ub098 \uc218\uc815\uc774 \ubd88\uac00\ub2a5\ud55c \uacbd\uc6b0, \ud574\ub2f9 \ud074\ub798\uc2a4 \ub610\ub294 API\ub97c \ub2e4\ub978 \ud074\ub798\uc2a4\uc758 \ud0c0\uc785 \ub610\ub294 \ub2e4\ub978 API\ub85c \uc0ac\uc6a9\ud574\uc57c\ub9cc \ud560\ub54c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ud328\ud134\uc774\ub2e4.<\/p>\n<h4>\uc608\uc81c \ucf54\ub4dc <\/h4>\n<p><img decoding=\"async\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/2020\/10\/adapter-1.png\" alt=\"\" width=\"800\" class=\"aligncenter size-full wp-image-10413\" \/><\/p>\n<p>\uc704\uc758 \ud074\ub798\uc2a4\ub2e4\uc5b4\uadf8\ub7a8\uc5d0\uc11c SamsungScanner\ub294 \ucef4\ud30c\uc77c\ub41c \ubc14\uc774\ub108\ub9ac \ud615\ud0dc\uc758 \ub77c\uc774\ube0c\ub7ec\ub9ac\ub85c\ub9cc \uc81c\uacf5\ub41c\ub2e4\uace0 \ud558\uc790. \uc774 SamsungScanner API\ub97c \uc774\uc6a9\ud558\uc5ec \uc0bc\uc131 \uc2a4\uce90\ub108\ub97c \uc81c\uc5b4\ud55c\ub2e4. \uc18c\uc2a4\ucf54\ub4dc\ub294 \uc81c\uacf5\ub418\uc9c0 \uc54a\uc73c\ub098 API\ub97c \uc18c\uc2a4\ucf54\ub4dc \ud615\ud0dc\uc758 \ubb38\uc11c\ub85c  \ud655\uc778\ud574\ubcf4\uc790. \uc18c\uc2a4\ucf54\ub4dc\ub294 \uc874\uc7ac\ud558\uc9c0 \uc54a\uc73c\ub098, \uc2e4\uc2b5\uc744 \uc804\uc81c\ub85c \uc735\ud1b5\uc131\uc744 \ubc1c\ud718\ud558\uae30 \ubc14\ub780\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">\r\npackage tstThread;\r\n\r\npublic class SamsungScanner {\r\n\tpublic boolean ____initialize() {\r\n\t\tSystem.out.println(\"SAMSUNG SCANNER DRIVER LOADED\");\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\tpublic boolean ____startScanning() {\r\n\t\tSystem.out.println(\"START SCANNING\");\r\n\t\t\r\n\t\ttry {\r\n\t\t\tThread.sleep(1000);\r\n\t\t\tSystem.out.println(\"END SCANNING\");\r\n\t\t} catch (InterruptedException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t\t\t\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\tpublic boolean ____cancelScanning() {\r\n\t\tSystem.out.println(\"CANCEL SCANNING\");\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\tpublic boolean ____release() {\r\n\t\tSystem.out.println(\"FREE ALL RESOURCES FOR SAMSUNG SCANNER DRIVER\");\r\n\t\treturn true;\r\n\t}\r\n}\r\n<\/pre>\n<p>\ubaa8\ub4e0 \uc2a4\uce90\ub108 \uc7a5\uce58\uc5d0 \ub300\ud574\uc11c, \uc2a4\uce90\ub108\ub97c \uc774\uc6a9\ud558\uae30 \uc704\ud574 \ud544\uc694\ud55c \uc778\ud130\ud398\uc774\uc2a4\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">\r\npackage tstThread;\r\n\r\npublic interface IScanner {\r\n\tboolean setup();\r\n\tboolean start();\r\n\tboolean cancel();\r\n\tvoid release();\r\n}\r\n<\/pre>\n<p>SamsungScanner API\ub97c IScanner API\uc5d0 \ub9de\ucdb0 \uc0ac\uc6a9\ud560 \uc218 \uc788\ub3c4\ub85d ScannerAdapter \ud074\ub798\uc2a4\ub97c \ucd94\uac00\ud588\uc73c\uba70, \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">\r\npackage tstThread;\r\n\r\npublic class ScannerAdapter implements IScanner {\r\n\tprivate SamsungScanner scanner;\r\n\tpublic ScannerAdapter(SamsungScanner scanner) {\r\n\t\tthis.scanner = scanner;\r\n\t}\r\n\t\r\n\t@Override\r\n\tpublic boolean setup() {\r\n\t\treturn scanner.____initialize();\r\n\t}\r\n\r\n\t@Override\r\n\tpublic boolean start() {\r\n\t\treturn scanner.____startScanning();\r\n\t}\r\n\r\n\t@Override\r\n\tpublic boolean cancel() {\r\n\t\treturn scanner.____cancelScanning();\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void release() {\r\n\t\tscanner.____release();\r\n\t}\r\n\r\n}\r\n<\/pre>\n<p>\uc774 \ud074\ub798\uc2a4\ub4e4\uc744 \uc0ac\uc6a9\ud558\ub294 User \ud074\ub798\uc2a4\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\">\r\npackage tstThread;\r\n\r\npublic class User {\r\n\tpublic static void main(String[] args) {\r\n\t\tIScanner scanner = new ScannerAdapter(new SamsungScanner());\r\n\t\t\r\n\t\tif(scanner.setup()) {\r\n\t\t\tscanner.start();\r\n\t\t\tscanner.release();\r\n\t\t}\r\n\t}\r\n}\r\n<\/pre>\n<p>\uc2e4\ud589\uacb0\uacfc\ub294 \ub2e4\uc74c\uacfc \uac19\ub2e4.<\/p>\n<pre class='code'>\r\nSAMSUNG SCANNER DRIVER LOADED\r\nSTART SCANNING\r\nEND SCANNING\r\nFREE ALL RESOURCES FOR SAMSUNG SCANNER DRIVER\r\n<\/pre>\n<p>\uc218\uc815\ud560 \uc218 \uc5c6\ub294 API\uc778 SamsungScanner\ub97c \uc6d0\ud558\ub294 \ud615\ud0dc\uc758 API\uc778 IScanner\ub85c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 Adapter\ub85c\uc368 ScannerAdapter\ub97c \uc0c8\ub86d\uac8c \uc815\uc758\ud558\uc5ec SamsungScanner\uc758 API\ub97c \uc131\uacf5\uc801\uc73c\ub85c \uc0ac\uc6a9\ud558\uace0 \uc788\ub2e4.<\/p>\n<div style='background:#efefef;border-radius:8px;padding:12px 24px'>\uc774 \uae00\uc740 \uc18c\ud504\ud2b8\uc6e8\uc5b4 \uc124\uacc4\uc758 \uae30\ubc18\uc774 \ub418\ub294 GoF\uc758 \ub514\uc790\uc778\ud328\ud134\uc5d0 \ub300\ud55c \uac15\uc758\uc790\ub8cc\uc785\ub2c8\ub2e4. \uc644\uc804\ud55c \uc2e4\uc2b5\uc744 \uc704\ud574 \uc774 \uae00\uc5d0\uc11c \uc18c\uac1c\ud558\ub294 \ud074\ub798\uc2a4 \ub2e4\uc774\uc5b4\uadf8\ub7a8\uacfc \uc608\uc81c \ucf54\ub4dc\ub294 \uc644\uc804\ud558\uac8c \uc2e4\ud589\ub418\ub3c4\ub85d \uc81c\uacf5\ub418\uc9c0\ub9cc, \uc0c1\ub300\uc801\uc73c\ub85c \uc608\uc81c \ucf54\ub4dc\uc640 \uad00\ub828\ub41c \uc124\uba85\uc774 \ud568\ucd95\uc801\uc73c\ub85c \uc81c\uacf5\ub418\uace0 \uc788\uc2b5\ub2c8\ub2e4. \uc774 \uae00\uc5d0 \ub300\ud574 \uad81\uae08\ud55c \uc810\uc774 \uc788\uc73c\uba74 \ub313\uae00\uc744 \ud1b5\ud574 \ub0a8\uaca8\uc8fc\uc2dc\uae30 \ubc14\ub78d\ub2c8\ub2e4.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\ud328\ud134\uba85\uce6d Adapter \ud544\uc694\ud55c \uc0c1\ud669 \uc774\ubbf8 \ub9cc\ub4e4\uc5b4\uc838 \uc81c\uacf5\ub418\ub294 \ud074\ub798\uc2a4 \ub610\ub294 API\uac00 \uc218\uc815\ud560 \uc218 \uc5c6\uac70\ub098 \uc218\uc815\uc774 \ubd88\uac00\ub2a5\ud55c \uacbd\uc6b0, \ud574\ub2f9 \ud074\ub798\uc2a4 \ub610\ub294 API\ub97c \ub2e4\ub978 \ud074\ub798\uc2a4\uc758 \ud0c0\uc785 \ub610\ub294 \ub2e4\ub978 API\ub85c \uc0ac\uc6a9\ud574\uc57c\ub9cc \ud560\ub54c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ud328\ud134\uc774\ub2e4. \uc608\uc81c \ucf54\ub4dc \uc704\uc758 \ud074\ub798\uc2a4\ub2e4\uc5b4\uadf8\ub7a8\uc5d0\uc11c SamsungScanner\ub294 \ucef4\ud30c\uc77c\ub41c \ubc14\uc774\ub108\ub9ac \ud615\ud0dc\uc758 \ub77c\uc774\ube0c\ub7ec\ub9ac\ub85c\ub9cc \uc81c\uacf5\ub41c\ub2e4\uace0 \ud558\uc790. \uc774 SamsungScanner API\ub97c \uc774\uc6a9\ud558\uc5ec \uc0bc\uc131 \uc2a4\uce90\ub108\ub97c \uc81c\uc5b4\ud55c\ub2e4. \uc18c\uc2a4\ucf54\ub4dc\ub294 \uc81c\uacf5\ub418\uc9c0 \uc54a\uc73c\ub098 API\ub97c \uc18c\uc2a4\ucf54\ub4dc &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=10412\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;[GoF] Adapter \ud328\ud134&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-10412","post","type-post","status-publish","format-standard","hentry","category-design"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10412"}],"version-history":[{"count":7,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10412\/revisions"}],"predecessor-version":[{"id":10567,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10412\/revisions\/10567"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10412"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}