{"id":10578,"date":"2020-10-29T21:10:57","date_gmt":"2020-10-29T12:10:57","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=10578"},"modified":"2020-11-04T11:31:26","modified_gmt":"2020-11-04T02:31:26","slug":"%ec%bd%94%ed%8b%80%eb%a6%b0-%ec%bd%94%eb%93%9c-%ec%a0%95%eb%a6%ac","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=10578","title":{"rendered":"\ucf54\ud2c0\ub9b0\uc758 observable, vetoable \uc704\uc784\uc790"},"content":{"rendered":"<p>\ucf54\ud2c0\ub9b0\uc740 2011\ub144 \uc911\uc21c\uc5d0 \uacf5\uac1c\ub418\uc5b4 \uc9c0\uc18d\uc801\uc73c\ub85c \ubc1c\uc804\ub418\uc5b4 \uc624\ub2e4\uac00 2019\ub144\uc5d0 \uad6c\uae00 \uc548\ub4dc\ub85c\uc774\ub4dc \uac1c\ubc1c \uc8fc\uc694 \uac1c\ubc1c\uc5b8\uc5b4\ub85c \ucc44\ud0dd\ub418\uba74\uc11c \ud604\ub300\uc801\uc778 \ud504\ub85c\uadf8\ub798\ubc0d \uc5b8\uc5b4\uc911 \ud558\ub098\uc785\ub2c8\ub2e4. \uc774 \uae00\uc740 \ucf54\ud2c0\ub9b0\uc758 \ub370\uc774\ud130 \ubcc0\uc218\uc5d0 obserable\uacfc vetoable \uc704\uc784\uc790\ub97c \uc9c0\uc815\ud558\uc5ec \ubcc0\uc218\uc758 \uac12\uc774 \ubcc0\uacbd\ub420 \uacbd\uc6b0 \uc6d0\ud558\ub294 \ub85c\uc9c1\uc744 \uc2e4\ud589\ud558\uac70\ub098 \ubcc0\uc218\uc758 \uac12\uc758 \ubcc0\uacbd\uc2dc \ud2b9\uc815 \uc870\uac74\uacfc \ub9de\uc9c0 \uc54a\uc73c\uba74 \ubcc0\uacbd\uc744 \ucde8\uc18c\ud558\ub294 \ub0b4\uc6a9\uc744 \ub300\ud574 \uc124\uba85\ud569\ub2c8\ub2e4.<\/p>\n<p>\uba3c\uc800 obserable \uc704\uc784\uc790\ub97c \ud1b5\ud55c \ubcc0\uc218\uac12 \ubcc0\uacbd\uc2dc \ucc98\ub9ac\uc785\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"kotlin\">\r\nimport kotlin.properties.Delegates\r\n\r\nclass User {\r\n    var name: String by Delegates.observable(\"\ucd08\uae30\uac12\") {\r\n        prop, old, new -> println(\"$old \uac12\uc774 $new \uac12\uc73c\ub85c \ubcc0\uacbd\ub429\ub2c8\ub2e4.\")\r\n    }\r\n}\r\n\r\nfun main() {\r\n    val user = User()\r\n    user.name = \"\ud64d\uae38\ub3d9\"\r\n    user.name = \"\uc784\uaebd\uc815\"\r\n}\r\n<\/pre>\n<p>\uc2e4\ud589 \uacb0\uacfc\ub294 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n<pre class='code'>\r\n\ucd08\uae30\uac12 \uac12\uc774 \ud64d\uae38\ub3d9 \uac12\uc73c\ub85c \ubcc0\uacbd\ub429\ub2c8\ub2e4.\r\n\ud64d\uae38\ub3d9 \uac12\uc774 \uc784\uaebd\uc815 \uac12\uc73c\ub85c \ubcc0\uacbd\ub429\ub2c8\ub2e4.\r\n<\/pre>\n<p>\ub2e4\uc74c\uc740 vetoable \uc704\uc784\uc790\uc785\ub2c8\ub2e4. \uac12\uc758 \ubcc0\uacbd\uc2dc \ud2b9\uc815\ud55c \uc870\uac74\uc5d0 \ub530\ub77c \ubcc0\uacbd\uc744 \ucde8\uc18c\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"kotlin\">\r\nimport kotlin.properties.Delegates\r\n\r\nclass MoreBiggerInt(initValue: Int) {\r\n    var value: Int by Delegates.vetoable(initValue) {\r\n        property, oldValue, newValue -> {\r\n        val result = newValue > oldValue\r\n        if(result) {\r\n            println(\"\ub354 \ud070 \uac12\uc774\ubbc0\ub85c \uac12\uc744 \ubcc0\uacbd\ud569\ub2c8\ub2e4.\")\r\n        } else {\r\n            println(\"\uc791\uc740 \uac12\uc774\ubbc0\ub85c \ubcc0\uacbd\uc744 \ucde8\uc18c\ud569\ub2c8\ub2e4.\")\r\n        }\r\n        result\r\n    }()\r\n    }\r\n}\r\n\r\nfun main() {\r\n    val vv = MoreBiggerInt(10)\r\n\r\n    vv.value = 20\r\n    println(\"${vv.value}\")\r\n\r\n    vv.value = 5\r\n    println(\"${vv.value}\")\r\n}\r\n<\/pre>\n<p>\uc2e4\ud589 \uacb0\uacfc\ub294 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n<pre class='code'>\r\n\ub354 \ud070 \uac12\uc774\ubbc0\ub85c \uac12\uc744 \ubcc0\uacbd\ud569\ub2c8\ub2e4.\r\n20\r\n\uc791\uc740 \uac12\uc774\ubbc0\ub85c \ubcc0\uacbd\uc744 \ucde8\uc18c\ud569\ub2c8\ub2e4.\r\n20\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\ucf54\ud2c0\ub9b0\uc740 2011\ub144 \uc911\uc21c\uc5d0 \uacf5\uac1c\ub418\uc5b4 \uc9c0\uc18d\uc801\uc73c\ub85c \ubc1c\uc804\ub418\uc5b4 \uc624\ub2e4\uac00 2019\ub144\uc5d0 \uad6c\uae00 \uc548\ub4dc\ub85c\uc774\ub4dc \uac1c\ubc1c \uc8fc\uc694 \uac1c\ubc1c\uc5b8\uc5b4\ub85c \ucc44\ud0dd\ub418\uba74\uc11c \ud604\ub300\uc801\uc778 \ud504\ub85c\uadf8\ub798\ubc0d \uc5b8\uc5b4\uc911 \ud558\ub098\uc785\ub2c8\ub2e4. \uc774 \uae00\uc740 \ucf54\ud2c0\ub9b0\uc758 \ub370\uc774\ud130 \ubcc0\uc218\uc5d0 obserable\uacfc vetoable \uc704\uc784\uc790\ub97c \uc9c0\uc815\ud558\uc5ec \ubcc0\uc218\uc758 \uac12\uc774 \ubcc0\uacbd\ub420 \uacbd\uc6b0 \uc6d0\ud558\ub294 \ub85c\uc9c1\uc744 \uc2e4\ud589\ud558\uac70\ub098 \ubcc0\uc218\uc758 \uac12\uc758 \ubcc0\uacbd\uc2dc \ud2b9\uc815 \uc870\uac74\uacfc \ub9de\uc9c0 \uc54a\uc73c\uba74 \ubcc0\uacbd\uc744 \ucde8\uc18c\ud558\ub294 \ub0b4\uc6a9\uc744 \ub300\ud574 \uc124\uba85\ud569\ub2c8\ub2e4. \uba3c\uc800 obserable \uc704\uc784\uc790\ub97c \ud1b5\ud55c \ubcc0\uc218\uac12 \ubcc0\uacbd\uc2dc \ucc98\ub9ac\uc785\ub2c8\ub2e4. import kotlin.properties.Delegates &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=10578\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;\ucf54\ud2c0\ub9b0\uc758 observable, vetoable \uc704\uc784\uc790&#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":[136],"tags":[],"class_list":["post-10578","post","type-post","status-publish","format-standard","hentry","category-kotlin"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10578","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=10578"}],"version-history":[{"count":4,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10578\/revisions"}],"predecessor-version":[{"id":10587,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10578\/revisions\/10587"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10578"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}