{"id":360558,"date":"2024-05-21T00:55:43","date_gmt":"2024-05-21T00:55:43","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=360558"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=360558","title":{"rendered":"<span>Kotlin \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c: \u043d\u044e\u0430\u043d\u0441\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/526\/5b8\/914\/5265b89144044ac2bde1660e3e803573.png\" width=\"780\" height=\"232\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/526\/5b8\/914\/5265b89144044ac2bde1660e3e803573.png\"\/><\/figure>\n<p>\u041a\u043e\u0442\u043b\u0438\u043d \u043e\u0447\u0435\u043d\u044c \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u0439 \u044f\u0437\u044b\u043a, \u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u0435\u0433\u043e \u043a\u043e\u0434 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 Java bytecode, \u0442\u043e \u0438\u0437\u044f\u0449\u043d\u044b\u0435\u00a0 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 kotlin \u0440\u0430\u0441\u043f\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u0432\u0435\u0441\u0438\u0441\u0442\u044b\u0435 \u0438 \u043c\u043e\u043d\u0441\u0442\u0440\u0443\u043e\u0437\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 Java. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u0441\u044b\u0433\u0440\u0430\u0442\u044c \u0441 \u0432\u0430\u043c\u0438 \u0437\u043b\u0443\u044e \u0448\u0443\u0442\u043a\u0443.\u00a0\u00a0<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u044d\u0442\u043e \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <strong>@JsonProperty<\/strong> \u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e data \u043a\u043b\u0430\u0441\u0441\u0430.\u00a0<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u044f<\/summary>\n<div class=\"spoiler__content\">\n<p>\u042f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u0435\u0439\u0441\u0435 6 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u0438 \u0441 \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u044d\u0442\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u043c\u043e\u0435 \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a kotlin \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0438 \u043a\u0430\u043a \u043e\u043d \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u0432\u043e\u0439 bytecode.\u00a0<\/p>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438 \u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439 \u0434\u0430\u043b \u0442\u043e\u043b\u0447\u043e\u043a \u043c\u043e\u0435\u043c\u0443 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044e kotlin \u0438 \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0441\u0447\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u043b \u0438\u0437 \u043c\u0435\u043d\u044f kotlin \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u0430.<\/p>\n<\/div>\n<\/details>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 data \u043a\u043b\u0430\u0441\u0441<\/p>\n<pre><code class=\"kotlin\">data class SomeData(@JsonProperty(\"id\") val someDataId: String)<\/code><\/pre>\n<p>\u0418\u0437 \u043a\u043e\u0434\u0430 \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f @JsonProperty \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u043a \u043f\u043e\u043b\u044e someDataId, \u0432\u0435\u0434\u044c \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u044f. \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0448 Json \u0444\u0430\u0439\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043f\u043e\u043b\u0435 &#171;id&#187; \u0432\u043c\u0435\u0441\u0442\u043e &#171;someDataId&#187; \u0438 \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438 \u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0444\u0430\u0439\u043b\u0430.<\/p>\n<p>\u041d\u043e \u0442\u0430\u043a \u043b\u0438 \u044d\u0442\u043e? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0434\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c kotlin \u043a\u043e\u0434, \u0442\u043e \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0432 Java \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a<\/p>\n<pre><code class=\"kotlin\">   public static final class SomeData {       @NotNull      \/\/ private field       private String someDataId;         @NotNull      \/\/ field getter       public final String getSomeDataId() {           return this.someDataId;       }        \/\/ constructor with field param       public SomeData(@NotNull String someDataId) {           Intrinsics.checkNotNullParameter(someDataId, \"someDataId\");          super();          this.someDataId = someDataId;       } <\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043d\u0430\u0448\u0435 \u043f\u043e\u043b\u0435 someDataId \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0432 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0435 \u043f\u043e\u043b\u0435, \u0433\u0435\u0442\u0442\u0435\u0440 \u0434\u043b\u044f \u043f\u043e\u043b\u044f \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430. \u0422\u0430\u043a \u043a \u0447\u0435\u043c\u0443 \u0436\u0435 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f?<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 @JsonProperty, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u043a\u00a0 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044e, \u043c\u0435\u0442\u043e\u0434\u0443 \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0443 \u043c\u0435\u0442\u043e\u0434\u0430. \u0422\u043e \u0435\u0441\u0442\u044c \u043a\u043e \u0432\u0441\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c Java, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0441\u043f\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0448\u0435 \u043f\u043e\u043b\u0435 data \u043a\u043b\u0430\u0441\u0441\u0430.\u00a0<\/p>\n<pre><code class=\"kotlin\">@Target({ElementType.ANNOTATION_TYPE,    ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonProperty<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 kotlin \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u044c. \u041e\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430\u0448\u0443 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e \u043a \u043f\u043e\u043b\u044e, \u0433\u0435\u0442\u0442\u0435\u0440\u0443, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0443 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430. \u041a\u0430\u043a \u0432\u044b \u0434\u0443\u043c\u0430\u0435\u0442\u0435, \u043a \u0447\u0435\u043c\u0443 \u043e\u043d \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435? <\/p>\n<blockquote>\n<p>\u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 &#8212; \u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0443 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430.\u00a0<\/p>\n<\/blockquote>\n<p>\u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0439 bytecode \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a \u0438 \u0432 \u043d\u0435\u043c \u044f\u0432\u043d\u043e \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043d\u0430\u0448\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0443 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<pre><code class=\"kotlin\">   public static final class SomeData {       @NotNull       private String someDataId;        @NotNull       public final String getSomeDataId() {          return this.someDataId;       }        public SomeData(@JsonProperty(\"id\") @NotNull String someDataId) {          Intrinsics.checkNotNullParameter(someDataId, \"someDataId\");          super();          this.someDataId = someDataId;       }<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u0437 Json, \u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f Json \u043f\u043e \u043d\u0430\u0448\u0435\u043c\u0443\u00a0 \u043a\u043b\u0430\u0441\u0441\u0443 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. \u041f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 Json \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0431\u0443\u0434\u0435\u0442 &#171;someDataId&#187; \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0433\u043e &#171;id&#187;.\u00a0<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u0447\u0435\u043c\u0443 kotlin \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a.<\/p>\n<h3>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u0432 kotlin<\/h3>\n<p>\u0414\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0439 \u0432 kotlin \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0433\u043b\u0430\u0441\u0438\u0442<\/p>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c \u044f\u0437\u044b\u043a\u0430, \u0442\u043e \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u043a \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u043c\u0443 <strong><em>use-site<\/em><\/strong> \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430:<\/p>\n<ul>\n<li>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043c\u0435\u0442\u043e\u0434\u0430<\/p>\n<\/li>\n<li>\n<p>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e (<em>\u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432 Java<\/em>)<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u0435<\/p>\n<\/li>\n<\/ul>\n<\/blockquote>\n<p>\u0410 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u044f\u0432\u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043a\u043e\u0434\u0430, \u0432 kotlin \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438.\u00a0<\/p>\n<blockquote>\n<p>@<strong>[use\u2011site]<\/strong>:Annotation <\/p>\n<\/blockquote>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438<\/p>\n<pre><code class=\"kotlin\">class Example(     @field:JsonProperty(\"Foo\") val foo,    \/\/ annotate Java field     @get:JsonProperty(\"Bar\") val bar,      \/\/ annotate Java getter     @param:JsonProperty(\"Some\") val some   \/\/ annotate Java constructor parameter )<\/code><\/pre>\n<p><strong>\u0412\u043e\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u0438\u043f\u043e\u0432 use-site \u0432\u0437\u044f\u0442\u044b\u0439 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 kotlin<\/strong><\/p>\n<ul>\n<li>\n<p>file<\/p>\n<\/li>\n<li>\n<p>property (annotations with this target are not visible to Java)<\/p>\n<\/li>\n<li>\n<p>field<\/p>\n<\/li>\n<li>\n<p>get (property getter)<\/p>\n<\/li>\n<li>\n<p>set (property setter)<\/p>\n<\/li>\n<li>\n<p>receiver (receiver parameter of an extension function or property)<\/p>\n<\/li>\n<li>\n<p>param (constructor parameter)<\/p>\n<\/li>\n<li>\n<p>setparam (property setter parameter)<\/p>\n<\/li>\n<li>\n<p>delegate (the field storing the delegate instance for a delegated property)<\/p>\n<\/li>\n<\/ul>\n<h3>\u0412\u044b\u0432\u043e\u0434\u044b<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e \u0432\u043e\u0442 \u0442\u0430\u043a<\/p>\n<pre><code class=\"kotlin\">data class SomeData(@field:JsonProperty(\"id\") var someDataId: String)<\/code><\/pre>\n<p>\u0410 \u0435\u0449\u0435 \u043b\u0443\u0447\u0448\u0435 \u0432\u043e\u0442 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0440\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u0438 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044e<\/p>\n<pre><code class=\"kotlin\">data class SomeData(     @param:JsonProperty(\"id\")     @get:JsonProperty(\"id\")     var someDataId: String ) <\/code><\/pre>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043d\u044b \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0439. \u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e 99% \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 kotlin \u043d\u0435 \u0437\u043d\u0430\u044e\u0442 \u043e\u0431 \u044d\u0442\u043e\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439.\u00a0<\/p>\n<p>\u041d\u043e \u044d\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441\u043e stackoverflow \u043a\u0430\u043a \u043d\u0430 \u043c\u0430\u0433\u0438\u044e, \u0430 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0447\u0435\u0433\u043e \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. <\/p>\n<blockquote>\n<p>\u0418\u0437\u0443\u0447\u0430\u0439\u0442\u0435 bytecode, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 kotlin. \u042d\u0442\u043e \u0434\u0430\u0441\u0442 \u0432\u0430\u043c \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0438\u043d\u043e\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u044f\u0437\u044b\u043a\u0430 \u0438 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u0430\u0448 \u043a\u043e\u0434.<\/p>\n<\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/774872\/\"> https:\/\/habr.com\/ru\/articles\/774872\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p>\u041a\u043e\u0442\u043b\u0438\u043d \u043e\u0447\u0435\u043d\u044c \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u0439 \u044f\u0437\u044b\u043a, \u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u0435\u0433\u043e \u043a\u043e\u0434 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 Java bytecode, \u0442\u043e \u0438\u0437\u044f\u0449\u043d\u044b\u0435\u00a0 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 kotlin \u0440\u0430\u0441\u043f\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u0432\u0435\u0441\u0438\u0441\u0442\u044b\u0435 \u0438 \u043c\u043e\u043d\u0441\u0442\u0440\u0443\u043e\u0437\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 Java. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u0441\u044b\u0433\u0440\u0430\u0442\u044c \u0441 \u0432\u0430\u043c\u0438 \u0437\u043b\u0443\u044e \u0448\u0443\u0442\u043a\u0443.\u00a0\u00a0<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u044d\u0442\u043e \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <strong>@JsonProperty<\/strong> \u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e data \u043a\u043b\u0430\u0441\u0441\u0430.\u00a0<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u044f<\/summary>\n<div class=\"spoiler__content\">\n<p>\u042f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u0435\u0439\u0441\u0435 6 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u0438 \u0441 \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u044d\u0442\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u043c\u043e\u0435 \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a kotlin \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0438 \u043a\u0430\u043a \u043e\u043d \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u0432\u043e\u0439 bytecode.\u00a0<\/p>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438 \u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439 \u0434\u0430\u043b \u0442\u043e\u043b\u0447\u043e\u043a \u043c\u043e\u0435\u043c\u0443 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044e kotlin \u0438 \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0441\u0447\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u043b \u0438\u0437 \u043c\u0435\u043d\u044f kotlin \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u0430.<\/p>\n<\/div>\n<\/details>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 data \u043a\u043b\u0430\u0441\u0441<\/p>\n<pre><code class=\"kotlin\">data class SomeData(@JsonProperty(\"id\") val someDataId: String)<\/code><\/pre>\n<p>\u0418\u0437 \u043a\u043e\u0434\u0430 \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f @JsonProperty \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u043a \u043f\u043e\u043b\u044e someDataId, \u0432\u0435\u0434\u044c \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u044f. \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0448 Json \u0444\u0430\u0439\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043f\u043e\u043b\u0435 &#171;id&#187; \u0432\u043c\u0435\u0441\u0442\u043e &#171;someDataId&#187; \u0438 \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438 \u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0444\u0430\u0439\u043b\u0430.<\/p>\n<p>\u041d\u043e \u0442\u0430\u043a \u043b\u0438 \u044d\u0442\u043e? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0434\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c kotlin \u043a\u043e\u0434, \u0442\u043e \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0432 Java \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a<\/p>\n<pre><code class=\"kotlin\">   public static final class SomeData {       @NotNull      \/\/ private field       private String someDataId;         @NotNull      \/\/ field getter       public final String getSomeDataId() {           return this.someDataId;       }        \/\/ constructor with field param       public SomeData(@NotNull String someDataId) {           Intrinsics.checkNotNullParameter(someDataId, \"someDataId\");          super();          this.someDataId = someDataId;       } <\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043d\u0430\u0448\u0435 \u043f\u043e\u043b\u0435 someDataId \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0432 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0435 \u043f\u043e\u043b\u0435, \u0433\u0435\u0442\u0442\u0435\u0440 \u0434\u043b\u044f \u043f\u043e\u043b\u044f \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430. \u0422\u0430\u043a \u043a \u0447\u0435\u043c\u0443 \u0436\u0435 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f?<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 @JsonProperty, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u043a\u00a0 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044e, \u043c\u0435\u0442\u043e\u0434\u0443 \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0443 \u043c\u0435\u0442\u043e\u0434\u0430. \u0422\u043e \u0435\u0441\u0442\u044c \u043a\u043e \u0432\u0441\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c Java, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0441\u043f\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0448\u0435 \u043f\u043e\u043b\u0435 data \u043a\u043b\u0430\u0441\u0441\u0430.\u00a0<\/p>\n<pre><code class=\"kotlin\">@Target({ElementType.ANNOTATION_TYPE,    ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation public @interface JsonProperty<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 kotlin \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u044c. \u041e\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430\u0448\u0443 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e \u043a \u043f\u043e\u043b\u044e, \u0433\u0435\u0442\u0442\u0435\u0440\u0443, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0443 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430. \u041a\u0430\u043a \u0432\u044b \u0434\u0443\u043c\u0430\u0435\u0442\u0435, \u043a \u0447\u0435\u043c\u0443 \u043e\u043d \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435? <\/p>\n<blockquote>\n<p>\u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 &#8212; \u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0443 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430.\u00a0<\/p>\n<\/blockquote>\n<p>\u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0439 bytecode \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a \u0438 \u0432 \u043d\u0435\u043c \u044f\u0432\u043d\u043e \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043d\u0430\u0448\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0443 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<pre><code class=\"kotlin\">   public static final class SomeData {       @NotNull       private String someDataId;        @NotNull       public final String getSomeDataId() {          return this.someDataId;       }        public SomeData(@JsonProperty(\"id\") @NotNull String someDataId) {          Intrinsics.checkNotNullParameter(someDataId, \"someDataId\");          super();          this.someDataId = someDataId;       }<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u0437 Json, \u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f Json \u043f\u043e \u043d\u0430\u0448\u0435\u043c\u0443\u00a0 \u043a\u043b\u0430\u0441\u0441\u0443 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. \u041f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 Json \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0431\u0443\u0434\u0435\u0442 &#171;someDataId&#187; \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0433\u043e &#171;id&#187;.\u00a0<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u0447\u0435\u043c\u0443 kotlin \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a.<\/p>\n<h3>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u0432 kotlin<\/h3>\n<p>\u0414\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0439 \u0432 kotlin \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0433\u043b\u0430\u0441\u0438\u0442<\/p>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c \u044f\u0437\u044b\u043a\u0430, \u0442\u043e \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u043a \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u043c\u0443 <strong><em>use-site<\/em><\/strong> \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430:<\/p>\n<ul>\n<li>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043c\u0435\u0442\u043e\u0434\u0430<\/p>\n<\/li>\n<li>\n<p>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e (<em>\u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432 Java<\/em>)<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u0435<\/p>\n<\/li>\n<\/ul>\n<\/blockquote>\n<p>\u0410 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u044f\u0432\u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043a\u043e\u0434\u0430, \u0432 kotlin \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438.\u00a0<\/p>\n<blockquote>\n<p>@<strong>[use\u2011site]<\/strong>:Annotation <\/p>\n<\/blockquote>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438<\/p>\n<pre><code class=\"kotlin\">class Example(     @field:JsonProperty(\"Foo\") val foo,    \/\/ annotate Java field     @get:JsonProperty(\"Bar\") val bar,      \/\/ annotate Java getter     @param:JsonProperty(\"Some\") val some   \/\/ annotate Java constructor parameter )<\/code><\/pre>\n<p><strong>\u0412\u043e\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u0438\u043f\u043e\u0432 use-site \u0432\u0437\u044f\u0442\u044b\u0439 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 kotlin<\/strong><\/p>\n<ul>\n<li>\n<p>file<\/p>\n<\/li>\n<li>\n<p>property (annotations with this target are not visible to Java)<\/p>\n<\/li>\n<li>\n<p>field<\/p>\n<\/li>\n<li>\n<p>get (property getter)<\/p>\n<\/li>\n<li>\n<p>set (property setter)<\/p>\n<\/li>\n<li>\n<p>receiver (receiver parameter of an extension function or property)<\/p>\n<\/li>\n<li>\n<p>param (constructor parameter)<\/p>\n<\/li>\n<li>\n<p>setparam (property setter parameter)<\/p>\n<\/li>\n<li>\n<p>delegate (the field storing the delegate instance for a delegated property)<\/p>\n<\/li>\n<\/ul>\n<h3>\u0412\u044b\u0432\u043e\u0434\u044b<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e \u0432\u043e\u0442 \u0442\u0430\u043a<\/p>\n<pre><code class=\"kotlin\">data class SomeData(@field:JsonProperty(\"id\") var someDataId: String)<\/code><\/pre>\n<p>\u0410 \u0435\u0449\u0435 \u043b\u0443\u0447\u0448\u0435 \u0432\u043e\u0442 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0440\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u0438 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044e<\/p>\n<pre><code class=\"kotlin\">data class SomeData(     @param:JsonProperty(\"id\")     @get:JsonProperty(\"id\")     var someDataId: String ) <\/code><\/pre>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043d\u044b \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0439. \u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e 99% \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 kotlin \u043d\u0435 \u0437\u043d\u0430\u044e\u0442 \u043e\u0431 \u044d\u0442\u043e\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439.\u00a0<\/p>\n<p>\u041d\u043e \u044d\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441\u043e stackoverflow \u043a\u0430\u043a \u043d\u0430 \u043c\u0430\u0433\u0438\u044e, \u0430 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0447\u0435\u0433\u043e \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. <\/p>\n<blockquote>\n<p>\u0418\u0437\u0443\u0447\u0430\u0439\u0442\u0435 bytecode, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 kotlin. \u042d\u0442\u043e \u0434\u0430\u0441\u0442 \u0432\u0430\u043c \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0438\u043d\u043e\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u044f\u0437\u044b\u043a\u0430 \u0438 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u0430\u0448 \u043a\u043e\u0434.<\/p>\n<\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/774872\/\"> https:\/\/habr.com\/ru\/articles\/774872\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-360558","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/360558","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=360558"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/360558\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=360558"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=360558"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=360558"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}