{"id":343649,"date":"2023-01-08T15:01:09","date_gmt":"2023-01-08T15:01:09","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=343649"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=343649","title":{"rendered":"<span>\u0422\u0435\u043e\u0440\u0438\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u0432 API \u0434\u043b\u044f \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438 Apache Cassandra<\/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<p><strong>DISCLAIMER<\/strong><\/p>\n<blockquote>\n<p>\u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Apache Cassandra. \u0421\u0442\u0430\u0442\u044c\u044f \u0434\u0430\u0441\u0442 \u043b\u0438\u0448\u044c \u043a\u0440\u0430\u0442\u043a\u0438\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f, \u0442.\u043a. \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u043c \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438. \u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0430 Java \u0432 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u044f\u0437\u044b\u043a<\/p>\n<\/blockquote>\n<p><strong>TLDR: \u0415\u0441\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0442\u0442\u0435\u0440\u043d Factory Method \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u0435\u043b \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 \u0442\u0435\u043e\u0440\u0438\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439, \u0442.\u0435. \u043a\u043e\u0440\u0442\u0435\u0436 \u0441 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044f\u043c\u0438, \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 Builder, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 API \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441 \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u043c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 Apache Cassandra<\/strong><\/p>\n<h2>\u041c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f<\/h2>\n<p>Apache Cassandra &#8212; \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0447\u0442\u0435\u043d\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f Apache Cassandra \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0440\u0430\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435. \u0422\u0430\u043a \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435: \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0441\u043b\u0438\u044f\u043d\u0438\u044f, \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0438, \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u043e \u043a\u043e\u043b\u043e\u043d\u043a\u0430\u043c \u0431\u0435\u0437 &#171;\u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432&#187;.<\/p>\n<p>\u0412 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0431\u0430\u0437\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u0442.\u0435. \u0414\u0430\u043d\u043d\u044b\u0435 \u27f6 \u041c\u043e\u0434\u0435\u043b\u044c \u27f6 \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u0414\u043b\u044f Apache Cassandra \u043f\u043e\u0434\u0445\u043e\u0434 \u0432\u044b\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0438\u0437\u043d\u0430\u043d\u043a\u0443, \u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0442.\u0435. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u27f6 \u041c\u043e\u0434\u0435\u043b\u044c \u27f6 \u0414\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c \u0432\u0441\u0442\u0430\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b:<\/p>\n<ul>\n<li>\n<p>\u0414\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u041a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0447\u0438\u0442\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043e\u0434\u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 Apache Cassandra \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0441\u0442\u0430\u0432\u043e\u043a \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u0431\u043b\u0438\u0446. \u0414\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0435\u0434\u0435\u0442 \u043a \u043d\u0435\u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u043e\u043c\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e, \u0447\u0442\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0435\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u043b\u043e\u043d\u043e\u043a. \u041a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u043e, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0435\u043a\u0438\u0439 &#171;\u0438\u043d\u0434\u0435\u043a\u0441&#187; \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u043e\u0435 \u0438\u043b\u0438, \u0432 \u0445\u0443\u0434\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u041a\u0430\u0436\u0434\u0430\u044f \u043a\u043e\u043b\u043e\u043d\u043a\u0430, \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0432 &#171;\u0438\u043d\u0434\u0435\u043a\u0441\u0435&#187;, \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e API \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0445 \u043f\u043e\u043b\u0435\u0439 \u043d\u0430 \u0431\u0430\u0437\u0435 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A4%D0%B0%D0%B1%D1%80%D0%B8%D1%87%D0%BD%D1%8B%D0%B9_%D0%BC%D0%B5%D1%82%D0%BE%D0%B4_(%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD_%D0%BF%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F)\" rel=\"noopener noreferrer nofollow\"><strong>Factory Method<\/strong><\/a>, <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A1%D1%82%D1%80%D0%BE%D0%B8%D1%82%D0%B5%D0%BB%D1%8C_(%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD_%D0%BF%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F)\" rel=\"noopener noreferrer nofollow\"><strong>Builder<\/strong><\/a> \u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9A%D0%BE%D0%BD%D0%B5%D1%87%D0%BD%D1%8B%D0%B9_%D0%B0%D0%B2%D1%82%D0%BE%D0%BC%D0%B0%D1%82\" rel=\"noopener noreferrer nofollow\"><strong>Finite State Machine<\/strong><\/a><\/p>\n<h2>\u041f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u0430\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c<\/h2>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043e\u0442\u0435\u043b\u0435\u0439. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043e\u0442\u0435\u043b\u0435\u0439 \u043f\u043e \u0437\u0432\u0435\u0437\u0434\u043d\u043e\u0441\u0442\u0438,<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0438\u0441\u043a \u043e\u0442\u0435\u043b\u0435\u0439 \u0440\u044f\u0434\u043e\u043c \u0441 \u043c\u0435\u0442\u0440\u043e,<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0432 \u043e\u0442\u0435\u043b\u0435,<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0443\u0434\u043e\u0431\u0441\u0442\u0432 \u0432 \u043d\u043e\u043c\u0435\u0440\u0435,<\/p>\n<\/li>\n<li>\n<p>\u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0432 \u043e\u0442\u0435\u043b\u0435.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0421\u0445\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<h4>\u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0427\u0435\u0431\u043e\u0442\u043a\u043e<\/h4>\n<p>\u041f\u043e \u0441\u043f\u0438\u0441\u043a\u0443 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f <strong>\u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0427\u0435\u0431\u043e\u0442\u043a\u043e<\/strong> &#8212; \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 Apache Cassandra.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/57\/mw\/ui\/57mwuiezokyxy8anhnpa2iba8ps.jpeg\" alt=\"\u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0427\u0435\u0431\u043e\u0442\u043a\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043e\u0442\u0435\u043b\u044f\u043c\u0438\" title=\"\u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0427\u0435\u0431\u043e\u0442\u043a\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043e\u0442\u0435\u043b\u044f\u043c\u0438\" width=\"auto\" height=\"auto\" data-src=\"https:\/\/habrastorage.org\/webt\/57\/mw\/ui\/57mwuiezokyxy8anhnpa2iba8ps.jpeg\" data-blurred=\"true\"\/><figcaption>\u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0427\u0435\u0431\u043e\u0442\u043a\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043e\u0442\u0435\u043b\u044f\u043c\u0438<\/figcaption><\/figure>\n<h3>\u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043a \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u0427\u0435\u0431\u043e\u0442\u043a\u043e:<\/h3>\n<ul>\n<li>\n<p>Q1, &#8230;, Q6 &#8212; \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0431\u044b\u043b\u0438 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u043c\u043e\u0434\u0435\u043b\u044c.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0442\u0440\u0435\u043b\u043a\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u044e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b: <\/p>\n<ul>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u043e\u0434 \u0441\u0442\u0440\u0435\u043b\u043a\u043e\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u043e\u043c\u0435\u0440\u0430 \u043e\u0442\u0435\u043b\u044f \u0438\u0437 <code>rooms_by_hotel<\/code>, \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043e\u0442\u0435\u043b\u044f <code>hotel_id<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 <code>hotels_by_id<\/code> (Q5);<\/p>\n<\/li>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u043d\u0430\u0447\u0430\u043b\u043e \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e, \u0437\u043d\u0430\u0447\u0438\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0438\u043b\u0438 \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043e\u0442\u0435\u043b\u0435\u0439 \u043f\u043e \u0437\u0432\u0435\u0437\u0434\u043d\u043e\u0441\u0442\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0437\u0432\u0435\u0437\u0434\u043d\u043e\u0441\u0442\u0438, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0446\u0438\u0444\u0440\u044b \u043e\u0442 1 \u0434\u043e 5 (Q2).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u0435\u0439, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 <code>K<\/code> \u0438 <code>C<\/code>, \u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447: <\/p>\n<ul>\n<li>\n<p><code>K<\/code> &#8212; \u043c\u0430\u0440\u043a\u0435\u0440 \u043a\u043b\u044e\u0447\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0430\/\u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (<strong>partitioning key<\/strong>). \u041d\u0430 \u043f\u043e\u043b\u044f \u043a\u043b\u044e\u0447\u0430 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043b\u0438\u0448\u044c \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e;<\/p>\n<\/li>\n<li>\n<p><code>C<\/code> &#8212; \u043c\u0430\u0440\u043a\u0435\u0440 \u043a\u043b\u044e\u0447\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 (<strong>clustering key<\/strong>). \u041d\u0430 \u043f\u043e\u043b\u044f \u043a\u043b\u044e\u0447\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043d\u0430 <code>=<\/code>, <code>><\/code>, <code>&lt;<\/code>, <code>>=<\/code>, <code>&lt;=<\/code>, <code>BETWEEN<\/code> \u0432 <strong>\u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u0430<\/strong>;<\/p>\n<\/li>\n<li>\n<p><code>C\u2193<\/code> &#8212; \u043c\u0430\u0440\u043a\u0435\u0440 \u043a\u043b\u044e\u0447\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044f. \u0421\u0442\u0440\u043e\u043a\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0430 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0432 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u043f\u043e \u043a\u043e\u043b\u043e\u043d\u043a\u0430\u043c, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u0432 \u043a\u043b\u044e\u0447 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0422\u0438\u043f\u044b \u043f\u043e\u043b\u0435\u0439 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0422\u0430\u0431\u043b\u0438\u0446\u044b<\/h4>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u0427\u0435\u0431\u043e\u0442\u043a\u043e \u0432 \u0431\u0430\u0437\u0435 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p><code>hotels_by_id<\/code> &#8212; \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0442\u0435\u043b\u0435\u0439;<\/p>\n<\/li>\n<li>\n<p><code>rooms_by_hotel<\/code> &#8212; \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0432 \u043e\u0442\u0435\u043b\u0435;<\/p>\n<\/li>\n<li>\n<p><code>reservations_by_hotel<\/code> &#8212; \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0437\u0430\u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u0430\u0445 \u0432 \u043e\u0442\u0435\u043b\u0435;<\/p>\n<\/li>\n<li>\n<p><code>hotels_by_metro<\/code> &#8212; \u043e\u0442\u0435\u043b\u0438 \u0440\u044f\u0434\u043e\u043c \u0441\u043e \u0441\u0442\u0430\u043d\u0446\u0438\u0435\u0439 \u043c\u0435\u0442\u0440\u043e;<\/p>\n<\/li>\n<li>\n<p><code>hotels_by_stars<\/code> &#8212; \u043e\u0442\u0435\u043b\u0438 \u043f\u043e \u0437\u0432\u0451\u0437\u0434\u043d\u043e\u0441\u0442\u0438;<\/p>\n<\/li>\n<li>\n<p><code>amenities_by_room<\/code> &#8212; \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432 \u043d\u043e\u043c\u0435\u0440\u0435.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f<\/h4>\n<ul>\n<li>\n<p>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043f\u043e\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <\/p>\n<ul>\n<li>\n<p><code>hotel_name<\/code> (\u0438\u043c\u044f \u043e\u0442\u0435\u043b\u044f): \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 <code>hotels_by_id<\/code>, <code>room_by_hotel<\/code>, <code>reservations_by_hotel<\/code>, <code>hotels_by_stars<\/code>, <code>hotels_by_metro<\/code>,<\/p>\n<\/li>\n<li>\n<p><code>hotel_id<\/code> (\u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043e\u0442\u0435\u043b\u044f): \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 <code>hotels_by_id<\/code>, <code>room_by_hotel<\/code>, <code>reservations_by_hotel<\/code>, <code>hotels_by_stars<\/code>, <code>hotels_by_metro<\/code>,<\/p>\n<\/li>\n<li>\n<p><code>stars<\/code> (\u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0437\u0432\u0451\u0437\u0434\u043d\u043e\u0441\u0442\u0438): \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 <code>hotels_by_id<\/code>, <code>hotels_by_stars<\/code>,<\/p>\n<\/li>\n<li>\n<p><code>room_id<\/code> (\u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043d\u043e\u043c\u0435\u0440\u0430): \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 <code>room_by_hotel<\/code>, <code>amenities_by_room<\/code>, <code>reservations_by_hotel<\/code>.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0414\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 join, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u0449\u0435\u043f\u0440\u0438\u043d\u044f\u0442\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f Apache Cassandra. \u0422\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0442\u0435\u043b\u0435\u0439 \u0440\u044f\u0434\u043e\u043c \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u043d\u0446\u0438\u0435\u0439 \u043c\u0435\u0442\u0440\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0435 <code>hotels_by_metro<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446 \u043d\u0430 java \u043e\u0431\u044a\u0435\u043a\u0442\u044b<\/h4>\n<p>\u041a\u043b\u0430\u0441\u0441\u044b \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u044b, \u0432 \u043d\u0438\u0445 \u043d\u0435\u0442 \u0433\u0435\u0442\u0442\u0435\u0440\u043e\u0432 \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u043e\u0432, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<pre><code class=\"java\">@Table(value = \"hotels_by_metro\") public class HotelByStation {      @PrimaryKeyColumn(name = \"station_name\", type = PrimaryKeyType.PARTITIONED, ordinal = 0)     @CassandraType(type = CassandraType.Name.TEXT)     private String station;      @PrimaryKeyColumn(name = \"hotel_name\", type = PrimaryKeyType.CLUSTERED, ordinal = 1)     @CassandraType(type = CassandraType.Name.TEXT)     private String hotelName;      @Column(\"hotel_id\")     @CassandraType(type = CassandraType.Name.UUID)     private UUID hotelId;      public HotelByStation(String station, String hotelName, UUID hotelId) {         this.station = station;         this.hotelName = hotelName;         this.hotelId = hotelId;     } }<\/code><\/pre>\n<pre><code class=\"java\">@Table(value = \"hotels_by_id\") public class HotelById {      @PrimaryKeyColumn(name = \"hotel_id\", type = PrimaryKeyType.PARTITIONED, ordinal = 0)     @CassandraType(type = CassandraType.Name.UUID)     private UUID hotelId;      @Column(\"hotel_name\")     @CassandraType(type = CassandraType.Name.TEXT)     private String hotelName;      @Column(\"stars\")     @CassandraType(type = CassandraType.Name.TINYINT)     private int stars;      @Column(\"description\")     @CassandraType(type = CassandraType.Name.TEXT)     private String description;      public HotelById(UUID hotelId, String hotelName, int stars, String description) {         this.hotelId = hotelId;         this.hotelName = hotelName;         this.stars = stars;         this.description = description;     } }<\/code><\/pre>\n<pre><code class=\"java\">@Table(value = \"hotels_by_stars\") public class HotelByStars {     @PrimaryKeyColumn(name = \"stars\", type = PrimaryKeyType.PARTITIONED, ordinal = 0)     @CassandraType(type = CassandraType.Name.TINYINT)     private int stars;      @PrimaryKeyColumn(name = \"hotel_name\", type = PrimaryKeyType.CLUSTERED, ordinal = 1)     @CassandraType(type = CassandraType.Name.TEXT)     private String hotelName;      @CassandraType(type = CassandraType.Name.UUID)     @Column(\"hotel_id\")     private UUID hotelId;      public HotelByStars(int stars, String hotelName, UUID hotelId) {         this.stars = stars;         this.hotelName = hotelName;         this.hotelId = hotelId;     } }<\/code><\/pre>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430<\/h2>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u043d\u043e\u0432\u044b\u0439 \u043e\u0442\u0435\u043b\u044c \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043e\u0442\u0435\u043b\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b: <code>hotels_by_id<\/code>, <code>hotels_by_metro<\/code>, <code>hotels_by_stars<\/code><\/p>\n<h3>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0432 \u043e\u0431\u0449\u0435\u043c \u0432\u0438\u0434\u0435<\/h3>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Apache Cassandra \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f DataStax \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0434\u043b\u044f Spring Data. \u0412 \u043e\u0431\u0449\u0435\u043c \u0432\u0438\u0434\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"java\">public class HotelInserter {          public static void addNewHotel(CassandraOperations ops) {         List&lt;Object> entities = getEntities(\/* \u043e\u043f\u0443\u0449\u0435\u043d\u043e *\/);          ops.batchOps(BatchType.LOGGED)                 .insert(entities)                 .execute();     }      private static List&lt;Object> getEntities(UUID hotelId, String hotelName, int stars, String description, String station) {         return null;     } }<\/code><\/pre>\n<h4>\u041d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f<\/h4>\n<ul>\n<li>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>HotelInserter#addNewHotel<\/code>: <\/p>\n<ul>\n<li>\n<p>\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 <code>CassandraOperations<\/code> \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 Apache Cassandra;<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432\u0441\u0442\u0430\u0432\u043a\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 <code>LOGGED BATCH<\/code>.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>HotelInserter#getEntities<\/code>: <\/p>\n<ul>\n<li>\n<p>\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437 \u0442\u0440\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0443), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0431\u0430\u0437\u0443;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 1. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435<\/h3>\n<p>\u0421\u0430\u043c\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435.<\/p>\n<pre><code class=\"java\">public class HotelInserter {      public static void addNewHotel(CassandraOperations ops) {         List&lt;Object> entities = getEntities(\/* \u043e\u043f\u0443\u0449\u0435\u043d\u043e *\/);          \/\/ \u043e\u043f\u0443\u0449\u0435\u043d\u043e     }          private static List&lt;Object> getEntities(UUID hotelId, String hotelName, int stars, String description, String station) {         HotelById hotelById = new HotelById(hotelId, hotelName, stars, description);         HotelByStars hotelByStars = new HotelByStars(stars, hotelName, hotelId);         HotelByStation hotelByStation = new HotelByStation(station, hotelName, hotelId);          return Arrays.asList(hotelById, hotelByStars, hotelByStation);     } }<\/code><\/pre>\n<h4>\u041d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f<\/h4>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f\u0445 DataStax \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 Apache Cassandra.<\/p>\n<h4>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/h4>\n<p>\u041a \u043f\u043b\u044e\u0441\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u044f.<\/p>\n<h4>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438<\/h4>\n<p>\u0418\u0437 \u043c\u0438\u043d\u0443\u0441\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u0440\u0438\u0433\u0438\u0434\u043d\u043e\u0441\u0442\u044c &#8212; \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b;<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u0433\u043d\u0438\u0442\u0438\u0432\u043d\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 &#8212; \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u0435\u043d \u043f\u0440\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0438 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430\u0445;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 Separation of Concerns &#8212; \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u044d\u0442\u0430\u043f\u044b \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435,<\/p>\n<\/li>\n<\/ul>\n<h3>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 2. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0431\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430<\/h3>\n<h4>\u0418\u0434\u0435\u044f<\/h4>\n<p>\u0410\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <strong>Factory Method<\/strong> (\u0424\u0430\u0431\u0440\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434). \u041e\u0431\u044b\u0447\u043d\u043e <strong>Factory Method<\/strong> \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u041d\u043e \u043d\u0438\u0447\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0438\u043f\u043e\u0432:<\/p>\n<pre><code class=\"java\">public class HotelFactory {     private final int stars;     private final String description;     private final String hotelName;     private final String station;     private final UUID hotelId;      HotelFactory(final int stars,                  final String description,                  final String hotelName,                  final String station,                  final UUID hotelId) {         this.stars = stars;         this.description = description;         this.hotelName = hotelName;         this.station = station;         this.hotelId = hotelId;     }      public HotelById createHotelById() {         return new HotelById(hotelId, hotelName, stars, description);     }      public HotelByStars createHotelByStars() {         return new HotelByStars(stars, hotelName, hotelId);     }      public HotelByStation createHotelByStation() {         return new HotelByStation(station, hotelName, hotelId);     } }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u044d\u0442\u043e\u043c, \u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434, \u043d\u043e \u0441 \u043e\u0434\u043d\u043e\u0439 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0435\u0439. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <strong>Builder<\/strong> \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"java\">public class Builder {     private int stars;     private String description;     private String hotelName;     private String station;     private UUID hotelId;      \/\/ \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0430\u0431\u0440\u0438\u043a\u0438     public HotelFactory createHotelFactory() {         return new HotelFactory(stars, description, hotelName, station, hotelId);     }      public Builder setStars(int stars) {         this.stars = stars;         return this;     }      public Builder setDescription(String description) {         this.description = description;         return this;     }      public Builder setHotelName(String hotelName) {         this.hotelName = hotelName;         return this;     }      public Builder setStation(String station) {         this.station = station;         return this;     }      public Builder setHotelId(UUID hotelId) {         this.hotelId = hotelId;         return this;     } }<\/code><\/pre>\n<h4>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h4>\n<p>\u041f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 <strong>Factory Method<\/strong> \u0438 <strong>Builder<\/strong> \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b:<\/p>\n<pre><code class=\"java\">public class HotelInserter {      public static void addNewHotel(CassandraOperations ops) {         List&lt;Object> entities = getEntities(\/* \u043e\u043f\u0443\u0449\u0435\u043d\u043e *\/);          \/\/ \u043e\u043f\u0443\u0449\u0435\u043d\u043e     }      private static List&lt;Object> getEntities(UUID hotelId, String hotelName, int stars, String description, String station) {         HotelFactory hotelFactory = new Builder()                 .setHotelId(hotelId)                 .setHotelName(hotelName)                 .setDescription(description)                 .setStars(stars)                 .setStation(station)                 .createHotelFactory(); \/\/ Builder -> Factory          \/\/ \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u0444\u0430\u0431\u0440\u0438\u043a\u0443         HotelById hotelById = hotelFactory.createHotelById();         HotelByStars hotelByStars = hotelFactory.createHotelByStars();         HotelByStation hotelByStation = hotelFactory.createHotelByStation();          return Arrays.asList(hotelById, hotelByStars, hotelByStation);     } }<\/code><\/pre>\n<h4>\u041d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f<\/h4>\n<p>\u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<ul>\n<li>\n<p>\u043a\u043b\u0430\u0441\u0441 <strong>Builder<\/strong> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u043c (\u043f\u0440\u0438\u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u043a \u043e\u0442\u0435\u043b\u044e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435);<\/p>\n<\/li>\n<li>\n<p>\u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d <strong>Factory Method<\/strong> \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430. \u041a\u0430\u0436\u0434\u0430\u044f \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044f \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0435\u0439, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442.<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0435\u0441\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044e\/\u043c\u0435\u0442\u043e\u0434 \u0432 \u0444\u0430\u0431\u0440\u0438\u043a\u0443. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0439 \u043a\u043e\u0434 \u043d\u0435 \u0441\u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0431\u0430\u0437\u0443 \u0432 \u043d\u0435\u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.<\/p>\n<h4>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/h4>\n<ul>\n<li>\n<p>\u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c &#8212; \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u043e\u043b\u044f \u0441\u0440\u0430\u0437\u0443, \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0435\u0439 \u0432 <strong>Builder<\/strong> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u043c;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043d\u0438\u0436\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u0433\u043d\u0438\u0442\u0438\u0432\u043d\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 &#8212; \u043a\u043e\u0434 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u043c\u0441\u044f;<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u043a\u043e\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438<\/h4>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0442\u0435\u043c, \u0443\u043a\u0430\u0437\u0430\u043b \u043b\u0438 \u043e\u043d \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c \u043a\u043b\u044e\u0447\u0435, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442 <strong>Builder<\/strong> \u043f\u043e\u0434\u0432\u0435\u0440\u0436\u0435\u043d \u043c\u0443\u0442\u0430\u0446\u0438\u044f\u043c, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0433\u043e\u043d\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442. \u0415\u0441\u043b\u0438 \u043e\u0434\u0438\u043d \u043e\u0442\u0435\u043b\u044c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u044f\u0434\u043e\u043c \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u0442\u0430\u043d\u0446\u0438\u044f\u043c\u0438 \u043c\u0435\u0442\u0440\u043e, \u0442\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 <strong>Builder<\/strong>, \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c: \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u043c\u0435\u0442\u0440\u043e. \u041d\u043e \u0442\u0443\u0442 \u0441\u0442\u043e\u0438\u0442 \u0443\u0447\u0435\u0441\u0442\u044c, \u0447\u0442\u043e \u0432 Apache Cassandra \u0437\u0430\u043f\u0438\u0441\u044c \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u0430\u044f, \u0430 <code>INSERT<\/code> &#8212; \u044d\u0442\u043e <code>UPSERT<\/code> (<code>INSERT<\/code> + <code>UPDATE<\/code>), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043e\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437 \u0431\u0435\u0437 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 3. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0430<\/h3>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0441 <strong>Factory Method<\/strong> + <strong>Builder<\/strong> \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u043c \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432. \u041a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0439 API \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0435\u0435 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432.<\/p>\n<h4>\u0418\u0434\u0435\u044f<\/h4>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u043b\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0430 &#171;\u043f\u0430\u0440\u0441\u0435\u0440\u0430&#187; \u0438\u043b\u0438 &#171;\u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f&#187;. \u0420\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0431\u0438\u0435\u043a\u0446\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u043f\u043e\u043b\u0435, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432 \u0441\u0435\u0442\u0442\u0435\u0440\u0430 \u0432 <strong>Builder<\/strong>, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438;<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u0437\u043e\u0432\u0430 \u0441\u0435\u0442\u0442\u0435\u0440\u043e\u0432 \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0435\u0439 \u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0432\u0445\u043e\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0440\u0435\u0434\u0438 \u043f\u043e\u043b\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0435\u0441\u0442\u044c \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044f:<\/p>\n<ul>\n<li>\n<p>\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 &#8212; \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 &#8212; \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0432\u0445\u043e\u0434\u044f\u0442 \u043d\u0438 \u0432 \u043e\u0434\u0438\u043d \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447.<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u0441\u0435\u0442\u0442\u0435\u0440\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u041f\u0443\u0441\u0442\u044c \u0441\u0440\u0435\u0434\u0438 \u0442\u0440\u0435\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043f\u044f\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0438 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 (\u0442.\u0435. \u0432\u0445\u043e\u0434\u044f\u0442 \u0432 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447): <code>A<\/code>, <code>B<\/code> \u0438 <code>C<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u0442\u0442\u0435\u0440\u043d <strong>Builder<\/strong> \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u0441\u0435\u0442\u0442\u0435\u0440\u043e\u0432, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u0437\u043e\u0432\u0430 \u0441\u0435\u0442\u0442\u0435\u0440\u043e\u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043d\u0430 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<\/li>\n<\/ul>\n<p><code>.*(A.*B.*C)|(A.*C.*B)|(B.*A.*C)|(B.*C.*A)|(C.*A.*B)|(C.*B.*A).*<\/code><\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u0435\u0442\u0442\u0435\u0440\u044b \u0434\u043b\u044f <code>A<\/code>, <code>B<\/code>, <code>C<\/code> \u0432 \u043b\u044e\u0431\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0438 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u044b.<\/p>\n<p>\u0418\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e \u043b\u044e\u0431\u043e\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u043a \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442 (&#171;\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b. \u041f\u0440\u0438\u043d\u0446\u0438\u043f\u044b, \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439&#187; \u0410. \u0412. \u0410\u0445\u043e, \u041c. \u0421. \u041b\u0430\u043c, \u0420. \u0421\u0435\u0442\u0438, \u0414. \u0414. \u0423\u043b\u044c\u043c\u0430\u043d):<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/q3\/ez\/ho\/q3ezhoqh1jhd-shlxyne3dsl2os.jpeg\" alt=\"\u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442 \u0434\u043b\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\" title=\"\u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442 \u0434\u043b\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\" width=\"auto\" height=\"auto\" data-src=\"https:\/\/habrastorage.org\/webt\/q3\/ez\/ho\/q3ezhoqh1jhd-shlxyne3dsl2os.jpeg\" data-blurred=\"true\"\/><figcaption>\u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442 \u0434\u043b\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/figcaption><\/figure>\n<h3>\u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u043a \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435:<\/h3>\n<ul>\n<li>\n<p>\u043a\u0440\u0443\u0436\u043a\u0438 \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f: <\/p>\n<ul>\n<li>\n<p>\u043a\u0440\u0443\u0436\u043a\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430 \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u043e\u0434\u043d\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435;<\/p>\n<\/li>\n<li>\n<p><code>I<\/code> &#8212; \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435;<\/p>\n<\/li>\n<li>\n<p><code>F<\/code> &#8212; \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0446\u0438\u0444\u0440\u0430 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0438\u043c\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p>\u0431\u0443\u043a\u0432\u044b \u0432 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043a \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f\u043c\u0438: <\/p>\n<ul>\n<li>\n<p>\u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u0441 \u0431\u0443\u043a\u0432\u0430\u043c\u0438 \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432 \u0434\u0440\u0443\u0433\u043e\u0435, \u0435\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b\u0441\u044f \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u0431\u0435\u0437 \u0431\u0443\u043a\u0432 \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u0431\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434;<\/p>\n<\/li>\n<li>\n<p>\u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u044b \u0438\u043c\u0435\u044e\u0442 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043d\u0430\u0434 \u0431\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u044b\u043c\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430\u043c\u0438.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u043d\u0435\u0442 \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f: \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439 \u0432 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043f\u0443\u0441\u0442\u043e\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0434\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b: \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e\u043b\u0435\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u0445 \u0432\u0441\u0435.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430<\/h4>\n<p>\u041a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043d\u0430\u0431\u043e\u0440\u0430 \u043d\u0443\u043b\u0435\u0439 \u0438 \u0435\u0434\u0438\u043d\u0438\u0446:<\/p>\n<ul>\n<li>\n<p>\u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 (\u043e\u043d\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e);<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e &#8212; \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u0435;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 &#8212; \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u043d\u0443\u043b\u0435\u0439 \u0438 \u0435\u0434\u0438\u043d\u0438\u0446 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0442\u0438\u043f\u044b, \u0447\u0442\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0434\u043e\u0440\u043e\u0433\u0443 \u043a \u0441\u0438\u043b\u044c\u043d\u044b\u043c \u0442\u0438\u043f\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u0438\u043d\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<h4>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<p>\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b-\u043c\u0430\u0440\u043a\u0435\u0440\u044b:<\/p>\n<pre><code class=\"java\">public interface State {} public interface Present extends State {} public interface Absent extends State {}<\/code><\/pre>\n<p>\u041a\u043b\u0430\u0441\u0441 <strong>Builder<\/strong> \u0447\u0435\u0440\u0435\u0437 \u0441\u0432\u043e\u0438 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442, \u043a\u0430\u043a\u0438\u0435 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0443\u0436\u0435 \u0431\u044b\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b:<\/p>\n<pre><code class=\"java\">public static final class Builder&lt;         HOTEL_ID_STATE extends State,         STARS_STATE extends State,         STATION_STATE extends State,         HOTEL_NAME_STATE extends State         > {     private final int stars;     private final String description;     private final String hotelName;     private final UUID hotelId;     private final String station;      private Builder(int stars, String description, String hotelName, UUID hotelId, String station) {         this.stars = stars;         this.description = description;         this.hotelName = hotelName;         this.hotelId = hotelId;         this.station = station;     }      public Builder&lt;Present, STARS_STATE, STATION_STATE, HOTEL_NAME_STATE> setHotelId(UUID hotelId) {         return new Builder&lt;>(stars, description, hotelName, hotelId, station);     }      public Builder&lt;HOTEL_ID_STATE, Present, STATION_STATE, HOTEL_NAME_STATE> setStars(int stars) {         return new Builder&lt;>(stars, description, hotelName, hotelId, station);     }      public Builder&lt;HOTEL_ID_STATE, STARS_STATE, Present, HOTEL_NAME_STATE> setStation(String station) {         return new Builder&lt;>(stars, description, hotelName, hotelId, station);     }      public Builder&lt;HOTEL_ID_STATE, STARS_STATE, STATION_STATE, Present> setHotelName(String hotelName) {         return new Builder&lt;>(stars, description, hotelName, hotelId, station);     }      public Builder&lt;HOTEL_ID_STATE, STARS_STATE, STATION_STATE, HOTEL_NAME_STATE> setDescription(String description) {         return new Builder&lt;>(stars, description, hotelName, hotelId, station);     } }<\/code><\/pre>\n<p>\u0424\u0430\u0431\u0440\u0438\u043a\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434:<\/p>\n<pre><code class=\"java\">public class HotelStateMachineFactory {     private final int stars;     private final String description;     private final String hotelName;     private final String station;     private final UUID hotelId;      \/\/ \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 Builder, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0441\u0435 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0440\u0430\u0432\u043d\u044b `Present`     public HotelStateMachineFactory(Builder&lt;Present, Present, Present, Present> builder) {         this.hotelId = builder.hotelId;         this.stars = builder.stars;         this.station = builder.station;         this.description = builder.description;         this.hotelName = builder.hotelName;     }      \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f Builder, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0441\u0435 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0440\u0430\u0432\u043d\u044b `Absent`     public static Builder&lt;Absent, Absent, Absent, Absent> builder() {         return new Builder&lt;>(-1, null, null, null, null);     }      public HotelById createHotelById() {         return new HotelById(hotelId, hotelName, stars, description);     }      public HotelByStars createHotelByStars() {         return new HotelByStars(stars, hotelName, hotelId);     }      public HotelByStation createHotelByStation() {         return new HotelByStation(station, hotelName, hotelId);     } }<\/code><\/pre>\n<p>\u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u043a\u043e\u0434\u0443:<\/p>\n<ul>\n<li>\n<p>\u0441\u0440\u0435\u0434\u0438 \u0442\u0440\u0435\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e\u0431 \u043e\u0442\u0435\u043b\u044f\u0445 \u0438\u043c\u0435\u0435\u0442\u0441\u044f: <\/p>\n<ul>\n<li>\n<p>\u0447\u0435\u0442\u044b\u0440\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u044f: <code>hotelId<\/code>, <code>stars<\/code>, <code>station<\/code>, <code>hotelName<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u043e\u0434\u043d\u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435: <code>description<\/code>;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u043a\u043b\u0430\u0441\u0441 <strong>Builder<\/strong> \u0438\u043c\u0435\u0435\u0442 \u0447\u0435\u0442\u044b\u0440\u0435 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435;<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u0438\u0431\u043e <code>Absent<\/code>, \u043b\u0438\u0431\u043e <code>Present<\/code>; \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u0435\u043d <code>State<\/code>? \u041e\u0442\u0432\u0435\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0432 \u043a\u043e\u043d\u0446\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0430;<\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u0433\u0434\u0430 \u0441\u0435\u0442\u0442\u0435\u0440 \u0432 <strong>Builder<\/strong> \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 <strong>Builder<\/strong>, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0432 <code>Present<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u043c\u0435\u0442\u043e\u0434 <code>HotelStateMachineFactory#builder<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <strong>Builder<\/strong>, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0441\u0435 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u0432 <code>Absent<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 <code>HotelStateMachineFactory<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043e\u0431\u044a\u0435\u043a\u0442 <strong>Builder<\/strong>, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0441\u0435 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u0432 <code>Present<\/code>;<\/p>\n<\/li>\n<li>\n<p>\u041a\u043b\u0430\u0441\u0441 <strong>Builder<\/strong> \u0438\u043c\u0435\u0435\u0442 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u0432\u043d\u0443\u0442\u0440\u0438 <code>HotelStateMachineFactory<\/code> \u043a\u0430\u043a \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <strong>Builder<\/strong> \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u043e \u0441\u0442\u0440\u043e\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 <code>HotelStateMachineFactory#builder<\/code>. \u0422\u0430\u043a \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u0441\u043e\u0437\u0434\u0430\u0442\u044c <code>Builder&lt;Present, Present, Present, Present><\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0438 \u043e\u0434\u043d\u043e \u043f\u043e\u043b\u0435 \u043d\u0435 \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043e.<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0432 <strong>Builder<\/strong> \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0432\u0435\u043d <strong>State<\/strong>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 <strong>Builder<\/strong> \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <strong>Builder<\/strong> \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043b\u0438\u0448\u044c \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u043c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>\u0432 <code>HotelStateMachineFactory#builder<\/code>,<\/p>\n<\/li>\n<li>\n<p>\u0432 \u0441\u0435\u0442\u0442\u0435\u0440\u0430\u0445 <strong>Builder<\/strong>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c API \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e.<\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435<\/h4>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"java\">public class HotelInserter {      public static void addNewHotel(CassandraOperations ops) {         List&lt;Object> entities = getEntities(\/* \u043e\u043f\u0443\u0449\u0435\u043d\u043e *\/);          \/\/ \u043e\u043f\u0443\u0449\u0435\u043d\u043e     }      private static List&lt;Object> getEntities(UUID hotelId, String hotelName, int stars, String description, String station) {         Builder&lt;Present, Present, Present, Present> builder =             HotelStateMachineFactory.builder()                 .setHotelId(hotelId)                 .setHotelName(hotelName)                 .setDescription(description)                 .setStars(stars)                 .setStation(station);          HotelStateMachineFactory hotelFactory = new HotelStateMachineFactory(builder);          HotelById hotelById = hotelFactory.createHotelById();         HotelByStars hotelByStars = hotelFactory.createHotelByStars();         HotelByStation hotelByStation = hotelFactory.createHotelByStation();          return Arrays.asList(hotelById, hotelByStars, hotelByStation);     } }<\/code><\/pre>\n<h4>\u041d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f<\/h4>\n<p>\u0417\u0430\u0434\u0430\u0447\u0443 \u043f\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 <strong>Factory<\/strong> \u0438 <strong>Builder<\/strong> \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 java, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u043c \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f <strong>Factory<\/strong> \u0438 <strong>Builder<\/strong>.<\/p>\n<h4>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/h4>\n<ul>\n<li>\n<p>\u0441\u0438\u043b\u044c\u043d\u0430\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f &#8212; \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0442\u0430\u043a\u043e\u0433\u043e API \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 &#8212; \u0435\u0441\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u0430\u0431\u0440\u0438\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044e, \u0430 <strong>Builder<\/strong> \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0439 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442 (\u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043d\u043e\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b), \u0447\u0442\u043e \u0441\u043b\u043e\u043c\u0430\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044e \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0430 (\u0438 \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e);<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c &#8212; \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435: <\/p>\n<ul>\n<li>\n<p>\u0432\u0441\u0435 \u043f\u043e\u043b\u044f \u0438\u043c\u0435\u044e\u0442 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 <code>final<\/code>,<\/p>\n<\/li>\n<li>\n<p>\u0432\u044b\u0437\u043e\u0432 \u043b\u044e\u0431\u043e\u0433\u043e \u0441\u0435\u0442\u0442\u0435\u0440\u0430 <strong>Builder<\/strong> \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 <strong>Builder<\/strong>.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438<\/h4>\n<ul>\n<li>\n<p>\u041e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u043e\u0442 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 <strong>Builder<\/strong> &#8212; \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 <strong>Builder<\/strong> \u043d\u0435\u0442 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <code>create<\/code> \u0438\u043b\u0438 <code>build<\/code> \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0444\u0430\u0431\u0440\u0438\u043a\u0438. \u041e\u0431\u044a\u0435\u043a\u0442 <strong>Builder<\/strong> \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 <strong>Factory<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 <strong>Builder<\/strong> &#8212; \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0442\u0430\u043a\u043e\u0433\u043e API \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0438 \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438. \u041c\u043e\u0436\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e <strong>Builder<\/strong> \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 shell \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u043d\u0435\u0439\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 &#8212; \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <strong>Builder<\/strong>, \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0431\u043e\u0440 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u044f\u0437\u0430\u043d \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u044b. \u0422\u0430\u043a, \u0435\u0441\u043b\u0438 \u0440\u044f\u0434\u043e\u043c \u0441 \u043e\u0442\u0435\u043b\u0435\u043c \u043d\u0435\u0442 \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u043c\u0435\u0442\u0440\u043e, \u0442\u043e <strong>Builder<\/strong> \u0432\u044b\u043d\u0443\u0434\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<\/li>\n<\/ul>\n<h2>\u041f\u0440\u0435\u0434\u0435\u043b\u044b \u0438 \u0442\u0435\u043e\u0440\u0438\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439<\/h2>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/am\/qs\/iu\/amqsiumzmfgz1urhw0zuhbagxws.jpeg\" alt=\"\u041f\u0440\u0435\u0434\u0435\u043b\u044b \u0432 \u0422\u0435\u043e\u0440\u0438\u0438 \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439\" title=\"\u041f\u0440\u0435\u0434\u0435\u043b\u044b \u0432 \u0422\u0435\u043e\u0440\u0438\u0438 \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439\" width=\"auto\" height=\"auto\" data-src=\"https:\/\/habrastorage.org\/webt\/am\/qs\/iu\/amqsiumzmfgz1urhw0zuhbagxws.jpeg\" data-blurred=\"true\"\/><figcaption>\u041f\u0440\u0435\u0434\u0435\u043b\u044b \u0432 \u0422\u0435\u043e\u0440\u0438\u0438 \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439<\/figcaption><\/figure>\n<p>\u0410 \u043f\u0440\u0438\u0447\u0435\u043c \u0442\u0443\u0442 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u0438 \u0442\u0435\u043e\u0440\u0438\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439? \u0412\u0441\u0435 \u0434\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u0432 \u0442\u0435\u043e\u0440\u0438\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043a\u043e\u0440\u0442\u0435\u0436\u0430, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043b\u044e\u0431\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0437 \u043a\u043e\u0440\u0442\u0435\u0436\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u044b \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043f\u0440\u0435\u0434\u0435\u043b\u0430. \u0414\u0430\u043b\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0442\u0435\u043e\u0440\u0435\u043c \u0438\u0437 \u0442\u0435\u043e\u0440\u0438\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0444\u0443\u043d\u043a\u0442\u043e\u0440 \u0434\u043b\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0432\u0435\u0440\u0441\u0438\u0439 \u0444\u0430\u0431\u0440\u0438\u043a\u0438.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041f\u0440\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0444\u0430\u0431\u0440\u0438\u043a\u0438 \u043c\u043e\u0436\u0435\u0442 \u0432\u0441\u0442\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441 &#171;\u041a\u0430\u043a\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0442\u0443\u043a \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043f\u043e\u0434 \u043e\u0434\u043d\u043e\u0439 \u0444\u0430\u0431\u0440\u0438\u043a\u043e\u0439?&#187;. \u041c\u043e\u0436\u043d\u043e \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0444\u0430\u043a\u0442\u0430, \u0447\u0442\u043e \u043e\u0434\u043d\u0430 \u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0432 \u0441\u0435\u0431\u044f \u043a\u0430\u043a \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e bounded context. \u0414\u0430\u043b\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c \u0435\u0435 \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0438\u0434\u0435\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f <strong>Builder<\/strong> \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043e\u043c \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439, \u0441\u0445\u043e\u0436\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0440\u0430\u0445 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 (<a href=\"https:\/\/medium.com\/@maximilianofelice\/builder-pattern-in-scala-with-phantom-types-3e29a167e863\" rel=\"noopener noreferrer nofollow\">scala<\/a>, <a href=\"https:\/\/blog.frankel.ch\/builder-pattern-finite-state-machine\/\" rel=\"noopener noreferrer nofollow\">java<\/a>), \u0447\u0442\u043e \u043b\u0438\u0448\u044c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 \u0436\u0438\u0437\u043d\u0435\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0438\u0434\u0435\u0438, \u0442.\u043a. \u0440\u0430\u0437\u043d\u044b\u0435 \u043b\u044e\u0434\u0438 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u043a \u043d\u0435\u0439.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u0434\u043b\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e API \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044c <a href=\"https:\/\/github.com\/datastaxdevs\" rel=\"noopener noreferrer nofollow\">GitHub DataStax<\/a>, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0430\u0431\u0440\u0438\u043a\u0438 \u043a \u0438\u0445 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0442\u0447\u0438 \u0441 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 pull request.<\/p>\n<h2>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e<\/h2>\n<p>\u041a\u043e\u0434 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0438\u0437 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043f\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u0432 <code>docker<\/code> \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0430 <a href=\"https:\/\/github.com\/neshkeev\/consistent-cassandra-builder\" rel=\"noopener noreferrer nofollow\">GitHub<\/a>.<\/p>\n<\/p>\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\/post\/709508\/\"> https:\/\/habr.com\/ru\/post\/709508\/<\/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<p><strong>DISCLAIMER<\/strong><\/p>\n<blockquote>\n<p>\u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Apache Cassandra. \u0421\u0442\u0430\u0442\u044c\u044f \u0434\u0430\u0441\u0442 \u043b\u0438\u0448\u044c \u043a\u0440\u0430\u0442\u043a\u0438\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f, \u0442.\u043a. \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u043c \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438. \u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0430 Java \u0432 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u044f\u0437\u044b\u043a<\/p>\n<\/blockquote>\n<p><strong>TLDR: \u0415\u0441\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0442\u0442\u0435\u0440\u043d Factory Method \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u0435\u043b \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 \u0442\u0435\u043e\u0440\u0438\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439, \u0442.\u0435. \u043a\u043e\u0440\u0442\u0435\u0436 \u0441 \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044f\u043c\u0438, \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 Builder, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 API \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441 \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u043c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 Apache Cassandra<\/strong><\/p>\n<h2>\u041c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f<\/h2>\n<p>Apache Cassandra &#8212; \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0447\u0442\u0435\u043d\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f Apache Cassandra \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0440\u0430\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435. \u0422\u0430\u043a \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435: \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0441\u043b\u0438\u044f\u043d\u0438\u044f, \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0438, \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u043e \u043a\u043e\u043b\u043e\u043d\u043a\u0430\u043c \u0431\u0435\u0437 &#171;\u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432&#187;.<\/p>\n<p>\u0412 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0431\u0430\u0437\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u0442.\u0435. \u0414\u0430\u043d\u043d\u044b\u0435 \u27f6 \u041c\u043e\u0434\u0435\u043b\u044c \u27f6 \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u0414\u043b\u044f Apache Cassandra \u043f\u043e\u0434\u0445\u043e\u0434 \u0432\u044b\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0438\u0437\u043d\u0430\u043d\u043a\u0443, \u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0442.\u0435. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u27f6 \u041c\u043e\u0434\u0435\u043b\u044c \u27f6 \u0414\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c \u0432\u0441\u0442\u0430\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b:<\/p>\n<ul>\n<li>\n<p>\u0414\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u041a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0447\u0438\u0442\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043e\u0434\u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 Apache Cassandra \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0441\u0442\u0430\u0432\u043e\u043a \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u0431\u043b\u0438\u0446. \u0414\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0435\u0434\u0435\u0442 \u043a \u043d\u0435\u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u043e\u043c\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e, \u0447\u0442\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0435\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u043b\u043e\u043d\u043e\u043a. \u041a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u043e, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0435\u043a\u0438\u0439 &#171;\u0438\u043d\u0434\u0435\u043a\u0441&#187; \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u043e\u0435 \u0438\u043b\u0438, \u0432 \u0445\u0443\u0434\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u041a\u0430\u0436\u0434\u0430\u044f \u043a\u043e\u043b\u043e\u043d\u043a\u0430, \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0432 &#171;\u0438\u043d\u0434\u0435\u043a\u0441\u0435&#187;, \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e API \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0445 \u043f\u043e\u043b\u0435\u0439 \u043d\u0430 \u0431\u0430\u0437\u0435 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A4%D0%B0%D0%B1%D1%80%D0%B8%D1%87%D0%BD%D1%8B%D0%B9_%D0%BC%D0%B5%D1%82%D0%BE%D0%B4_(%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD_%D0%BF%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F)\" rel=\"noopener noreferrer nofollow\"><strong>Factory Method<\/strong><\/a>, <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A1%D1%82%D1%80%D0%BE%D0%B8%D1%82%D0%B5%D0%BB%D1%8C_(%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD_%D0%BF%D1%80%D0%BE%D0%B5%D0%BA%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F)\" rel=\"noopener noreferrer nofollow\"><strong>Builder<\/strong><\/a> \u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9A%D0%BE%D0%BD%D0%B5%D1%87%D0%BD%D1%8B%D0%B9_%D0%B0%D0%B2%D1%82%D0%BE%D0%BC%D0%B0%D1%82\" rel=\"noopener noreferrer nofollow\"><strong>Finite State Machine<\/strong><\/a><\/p>\n<h2>\u041f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u0430\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c<\/h2>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043e\u0442\u0435\u043b\u0435\u0439. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u043e\u0442\u0435\u043b\u0435\u0439 \u043f\u043e \u0437\u0432\u0435\u0437\u0434\u043d\u043e\u0441\u0442\u0438,<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0438\u0441\u043a \u043e\u0442\u0435\u043b\u0435\u0439 \u0440\u044f\u0434\u043e\u043c \u0441 \u043c\u0435\u0442\u0440\u043e,<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0432 \u043e\u0442\u0435\u043b\u0435,<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0443\u0434\u043e\u0431\u0441\u0442\u0432 \u0432 \u043d\u043e\u043c\u0435\u0440\u0435,<\/p>\n<\/li>\n<li>\n<p>\u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0432 \u043e\u0442\u0435\u043b\u0435.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0421\u0445\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<h4>\u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0427\u0435\u0431\u043e\u0442\u043a\u043e<\/h4>\n<p>\u041f\u043e \u0441\u043f\u0438\u0441\u043a\u0443 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f <strong>\u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0427\u0435\u0431\u043e\u0442\u043a\u043e<\/strong> &#8212; \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 Apache Cassandra.<\/p>\n<figure class=\"\"><figcaption>\u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u0427\u0435\u0431\u043e\u0442\u043a\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043e\u0442\u0435\u043b\u044f\u043c\u0438<\/figcaption><\/figure>\n<h3>\u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043a \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u0427\u0435\u0431\u043e\u0442\u043a\u043e:<\/h3>\n<ul>\n<li>\n<p>Q1, &#8230;, Q6 &#8212; \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0431\u044b\u043b\u0438 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0437\u0430\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u043c\u043e\u0434\u0435\u043b\u044c.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0442\u0440\u0435\u043b\u043a\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u044e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b: <\/p>\n<ul>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430, \u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u043e\u0434 \u0441\u0442\u0440\u0435\u043b\u043a\u043e\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u043e\u043c\u0435\u0440\u0430 \u043e\u0442\u0435\u043b\u044f \u0438\u0437 <code>rooms_by_hotel<\/code>, \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043e\u0442\u0435\u043b\u044f <code>hotel_id<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 <code>hotels_by_id<\/code> (Q5);<\/p>\n<\/li>\n<li>\n<p>\u0435\u0441\u043b\u0438 \u043d\u0430\u0447\u0430\u043b\u043e \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e, \u0437\u043d\u0430\u0447\u0438\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0438\u043b\u0438 \u044d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u043e\u0442\u0435\u043b\u0435\u0439 \u043f\u043e \u0437\u0432\u0435\u0437\u0434\u043d\u043e\u0441\u0442\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0437\u0432\u0435\u0437\u0434\u043d\u043e\u0441\u0442\u0438, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0446\u0438\u0444\u0440\u044b \u043e\u0442 1 \u0434\u043e 5 (Q2).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u0435\u0439, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 <code>K<\/code> \u0438 <code>C<\/code>, \u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447: <\/p>\n<ul>\n<li>\n<p><code>K<\/code> &#8212; \u043c\u0430\u0440\u043a\u0435\u0440 \u043a\u043b\u044e\u0447\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0430\/\u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (<strong>partitioning key<\/strong>). \u041d\u0430 \u043f\u043e\u043b\u044f \u043a\u043b\u044e\u0447\u0430 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043b\u0438\u0448\u044c \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e;<\/p>\n<\/li>\n<li>\n<p><code>C<\/code> &#8212; \u043c\u0430\u0440\u043a\u0435\u0440 \u043a\u043b\u044e\u0447\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 (<strong>clustering key<\/strong>). \u041d\u0430 \u043f\u043e\u043b\u044f \u043a\u043b\u044e\u0447\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043d\u0430 <code>=<\/code>, <code>><\/code>, <code>&lt;<\/code>, <code>>=<\/code>, <code>&lt;=<\/code>, <code>BETWEEN<\/code> \u0432 <strong>\u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u0430<\/strong>;<\/p>\n<\/li>\n<li>\n<p><code>C\u2193<\/code> &#8212; \u043c\u0430\u0440\u043a\u0435\u0440 \u043a\u043b\u044e\u0447\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0443\u0431\u044b\u0432\u0430\u043d\u0438\u044f. \u0421\u0442\u0440\u043e\u043a\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0430 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0432 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u043f\u043e \u043a\u043e\u043b\u043e\u043d\u043a\u0430\u043c, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u0432 \u043a\u043b\u044e\u0447 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043f\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u043d\u0438\u044e.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0422\u0438\u043f\u044b \u043f\u043e\u043b\u0435\u0439 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0422\u0430\u0431\u043b\u0438\u0446\u044b<\/h4>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u0427\u0435\u0431\u043e\u0442\u043a\u043e \u0432 \u0431\u0430\u0437\u0435 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p><code>hotels_by_id<\/code> &#8212; \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0442\u0435\u043b\u0435\u0439;<\/p>\n<\/li>\n<li>\n<p><code>rooms_by_hotel<\/code> &#8212; \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u0432 \u043e\u0442\u0435\u043b\u0435;<\/p>\n<\/li>\n<li>\n<p><code>reservations_by_hotel<\/code> &#8212; \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0437\u0430\u0431\u0440\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u0430\u0445 \u0432 \u043e\u0442\u0435\u043b\u0435;<\/p>\n<\/li>\n<li>\n<p><code>hotels_by_metro<\/code> &#8212; \u043e\u0442\u0435\u043b\u0438 \u0440\u044f\u0434\u043e\u043c \u0441\u043e \u0441\u0442\u0430\u043d\u0446\u0438\u0435\u0439 \u043c\u0435\u0442\u0440\u043e;<\/p>\n<\/li>\n<li>\n<p><code>hotels_by_stars<\/code> &#8212; \u043e\u0442\u0435\u043b\u0438 \u043f\u043e \u0437\u0432\u0451\u0437\u0434\u043d\u043e\u0441\u0442\u0438;<\/p>\n<\/li>\n<li>\n<p><code>amenities_by_room<\/code> &#8212; \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432 \u043d\u043e\u043c\u0435\u0440\u0435.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f<\/h4>\n<ul>\n<li>\n<p>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043f\u043e\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: <\/p>\n<ul>\n<li>\n<p><code>hotel_name<\/code> (\u0438\u043c\u044f \u043e\u0442\u0435\u043b\u044f): \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 <code>hotels_by_id<\/code>, <code>room_by_hotel<\/code>, <code>reservations_by_hotel<\/code>, <code>hotels_by_stars<\/code>, <code>hotels_by_metro<\/code>,<\/p>\n<\/li>\n<li>\n<p><code>hotel_id<\/code> (\u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043e\u0442\u0435\u043b\u044f): \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 <code>hotels_by_id<\/code>, <code>room_by_hotel<\/code>, <code>reservations_by_hotel<\/code>, <code>hotels_by_stars<\/code>, <code>hotels_by_metro<\/code>,<\/p>\n<\/li>\n<li>\n<p><code>stars<\/code> (\u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0437\u0432\u0451\u0437\u0434\u043d\u043e\u0441\u0442\u0438): \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 <code>hotels_by_id<\/code>, <code>hotels_by_stars<\/code>,<\/p>\n<\/li>\n<li>\n<p><code>room_id<\/code> (\u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043d\u043e\u043c\u0435\u0440\u0430): \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 <code>room_by_hotel<\/code>, <code>amenities_by_room<\/code>, <code>reservations_by_hotel<\/code>.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0414\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 join, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u0449\u0435\u043f\u0440\u0438\u043d\u044f\u0442\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f Apache Cassandra. \u0422\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0442\u0435\u043b\u0435\u0439 \u0440\u044f\u0434\u043e\u043c \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u043d\u0446\u0438\u0435\u0439 \u043c\u0435\u0442\u0440\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0442\u0430\u0431\u043b\u0438\u0446\u0435 <code>hotels_by_metro<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<\/li>\n<\/ul>\n<h4>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446 \u043d\u0430 java \u043e\u0431\u044a\u0435\u043a\u0442\u044b<\/h4>\n<p>\u041a\u043b\u0430\u0441\u0441\u044b \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u044b, \u0432 \u043d\u0438\u0445 \u043d\u0435\u0442 \u0433\u0435\u0442\u0442\u0435\u0440\u043e\u0432 \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u043e\u0432, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<pre><code class=\"java\">@Table(value = \"hotels_by_metro\") public class HotelByStation {      @PrimaryKeyColumn(name = \"station_name\", type = PrimaryKeyType.PARTITIONED, ordinal = 0)     @CassandraType(type = CassandraType.Name.TEXT)     private String station;      @PrimaryKeyColumn(name = \"hotel_name\", type = PrimaryKeyType.CLUSTERED, ordinal = 1)     @CassandraType(type = CassandraType.Name.TEXT)     private String hotelName;      @Column(\"hotel_id\")     @CassandraType(type = CassandraType.Name.UUID)     private UUID hotelId;      public HotelByStation(String station, String hotelName, UUID hotelId) {         this.station = station;         this.hotelName = hotelName;         this.hotelId = hotelId;     } }<\/code><\/pre>\n<pre><code class=\"java\">@Table(value = \"hotels_by_id\") public class HotelById {      @PrimaryKeyColumn(name = \"hotel_id\", type = PrimaryKeyType.PARTITIONED, ordinal = 0)     @CassandraType(type = CassandraType.Name.UUID)     private UUID hotelId;      @Column(\"hotel_name\")     @CassandraType(type = CassandraType.Name.TEXT)     private String hotelName;      @Column(\"stars\")     @CassandraType(type = CassandraType.Name.TINYINT)     private int stars;      @Column(\"description\")     @CassandraType(type = CassandraType.Name.TEXT)     private String description;      public HotelById(UUID hotelId, String hotelName, int stars, String description) {         this.hotelId = hotelId;         this.hotelName = hotelName;         this.stars = stars;         this.description = description;     } }<\/code><\/pre>\n<pre><code class=\"java\">@Table(value = \"hotels_by_stars\") public class HotelByStars {     @PrimaryKeyColumn(name = \"stars\", type = PrimaryKeyType.PARTITIONED, ordinal = 0)     @CassandraType(type = CassandraType.Name.TINYINT)     private int stars;      @PrimaryKeyColumn(name = \"hotel_name\", type = PrimaryKeyType.CLUSTERED, ordinal = 1)     @CassandraType(type = CassandraType.Name.TEXT)     private String hotelName;      @CassandraType(type = CassandraType.Name.UUID)     @Column(\"hotel_id\")     private UUID hotelId;      public HotelByStars(int stars, String hotelName, UUID hotelId) {         this.stars = stars;         this.hotelName = hotelName;         this.hotelId = hotelId;     } }<\/code><\/pre>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430<\/h2>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u043d\u043e\u0432\u044b\u0439 \u043e\u0442\u0435\u043b\u044c \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043e\u0442\u0435\u043b\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044b: <code>hotels_by_id<\/code>, <code>hotels_by_metro<\/code>, <code>hotels_by_stars<\/code><\/p>\n<h3>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0432 \u043e\u0431\u0449\u0435\u043c \u0432\u0438\u0434\u0435<\/h3>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Apache Cassandra \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f DataStax \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0434\u043b\u044f Spring Data. \u0412 \u043e\u0431\u0449\u0435\u043c \u0432\u0438\u0434\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"java\">public class HotelInserter {          public static void addNewHotel(CassandraOperations ops) {         List&lt;Object> entities = getEntities(\/* \u043e\u043f\u0443\u0449\u0435\u043d\u043e *\/);          ops.batchOps(BatchType.LOGGED)                 .insert(entities)                 .execute();     }      private static List&lt;Object> getEntities(UUID hotelId, String hotelName, int stars, String description, String station) {         return null;     } }<\/code><\/pre>\n<h4>\u041d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f<\/h4>\n<ul>\n<li>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>HotelInserter#addNewHotel<\/code>: <\/p>\n<ul>\n<li>\n<p>\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 <code>CassandraOperations<\/code> \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 Apache Cassandra;<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432\u0441\u0442\u0430\u0432\u043a\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 <code>LOGGED BATCH<\/code>.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>HotelInserter#getEntities<\/code>: <\/p>\n<ul>\n<li>\n<p>\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437 \u0442\u0440\u0435\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0443), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0431\u0430\u0437\u0443;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 1. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435<\/h3>\n<p>\u0421\u0430\u043c\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435.<\/p>\n<pre><code class=\"java\">public class HotelInserter {      public static void addNewHotel(CassandraOperations ops) {         List&lt;Object> entities = getEntities(\/* \u043e\u043f\u0443\u0449\u0435\u043d\u043e *\/);          \/\/ \u043e\u043f\u0443\u0449\u0435\u043d\u043e     }          private static List&lt;Object> getEntities(UUID hotelId, String hotelName, int stars, String description, String station) {         HotelById hotelById = new HotelById(hotelId, hotelName, stars, description);         HotelByStars hotelByStars = new HotelByStars(stars, hotelName, hotelId);         HotelByStation hotelByStation = new HotelByStation(station, hotelName, hotelId);          return Arrays.asList(hotelById, hotelByStars, hotelByStation);     } }<\/code><\/pre>\n<h4>\u041d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f<\/h4>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f\u0445 DataStax \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 Apache Cassandra.<\/p>\n<h4>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430<\/h4>\n<p>\u041a \u043f\u043b\u044e\u0441\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u044f.<\/p>\n<h4>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438<\/h4>\n<p>\u0418\u0437 \u043c\u0438\u043d\u0443\u0441\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u0440\u0438\u0433\u0438\u0434\u043d\u043e\u0441\u0442\u044c &#8212; \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b;<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u0433\u043d\u0438\u0442\u0438\u0432\u043d\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 &#8212; \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u0435\u043d \u043f\u0440\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0438 \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430\u0445;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 Separation of Concerns &#8212; \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u044d\u0442\u0430\u043f\u044b \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435,<\/p>\n<\/li>\n<\/ul>\n<h3>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 2. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0431\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430<\/h3>\n<h4>\u0418\u0434\u0435\u044f<\/h4>\n<p>\u0410\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <strong>Factory Method<\/strong> (\u0424\u0430\u0431\u0440\u0438\u0447\u043d\u044b\u0439<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-343649","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/343649","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=343649"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/343649\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=343649"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=343649"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=343649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}