{"action":"created","comment":{"url":"https://api.github.com/repos/datastax/java-driver/pulls/comments/47672774","id":47672774,"diff_hunk":"@@ -0,0 +1,118 @@\n+/*\n+ *      Copyright (C) 2012-2015 DataStax Inc.\n+ *\n+ *   Licensed under the Apache License, Version 2.0 (the \"License\");\n+ *   you may not use this file except in compliance with the License.\n+ *   You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ *   Unless required by applicable law or agreed to in writing, software\n+ *   distributed under the License is distributed on an \"AS IS\" BASIS,\n+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ *   See the License for the specific language governing permissions and\n+ *   limitations under the License.\n+ */\n+package com.datastax.driver.core.schemabuilder;\n+\n+import com.google.common.base.Optional;\n+\n+import java.util.Map;\n+\n+/**\n+ * The keyspace options used in CREATE KEYSPACE or ALTER KEYSPACE statements.\n+ * <p/>\n+ * Implementation notes: this class is abstract and not meant to use directly.\n+ */\n+public abstract class KeyspaceOptions<T extends KeyspaceOptions> extends SchemaStatement {","path":"driver-core/src/main/java/com/datastax/driver/core/schemabuilder/KeyspaceOptions.java","position":27,"original_position":27,"commit_id":"67588f49d7a3aa6a52abc320434ed6e977b3ba8e","original_commit_id":"67588f49d7a3aa6a52abc320434ed6e977b3ba8e","user":{"login":"adutra","id":463876,"avatar_url":"https://avatars.githubusercontent.com/u/463876?v=3","gravatar_id":"","url":"https://api.github.com/users/adutra","html_url":"https://github.com/adutra","followers_url":"https://api.github.com/users/adutra/followers","following_url":"https://api.github.com/users/adutra/following{/other_user}","gists_url":"https://api.github.com/users/adutra/gists{/gist_id}","starred_url":"https://api.github.com/users/adutra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adutra/subscriptions","organizations_url":"https://api.github.com/users/adutra/orgs","repos_url":"https://api.github.com/users/adutra/repos","events_url":"https://api.github.com/users/adutra/events{/privacy}","received_events_url":"https://api.github.com/users/adutra/received_events","type":"User","site_admin":false},"body":"I think we can simplify this a bit. This class could be public and concrete and the two subclasses declared in `CreateKeyspace` and `AlterKeyspace` could be deleted. To achieve this, we could modify the constructor to take the parent statement as an argument, stg along the lines of:\r\n\r\n```java\r\npublic class KeyspaceOptions extends SchemaStatement {\r\n\r\n    private final SchemaStatement statement;\r\n\r\n    //...\r\n\r\n    public KeyspaceOptions(SchemaStatement statement) {\r\n        this.statement = statement;\r\n    }\r\n\r\n    //...\r\n\r\n    @Override\r\n    String buildInternal() {\r\n        StringBuilder renderedStatement = new StringBuilder(statement.buildInternal());\r\n        renderedStatement.append(\"\\n\\tWITH\\n\\t\\t\");\r\n        //...\r\n    }\r\n\r\n}\r\n```","created_at":"2015-12-15T17:59:56Z","updated_at":"2015-12-15T17:59:56Z","html_url":"https://github.com/datastax/java-driver/pull/558#discussion_r47672774","pull_request_url":"https://api.github.com/repos/datastax/java-driver/pulls/558","_links":{"self":{"href":"https://api.github.com/repos/datastax/java-driver/pulls/comments/47672774"},"html":{"href":"https://github.com/datastax/java-driver/pull/558#discussion_r47672774"},"pull_request":{"href":"https://api.github.com/repos/datastax/java-driver/pulls/558"}}},"pull_request":{"url":"https://api.github.com/repos/datastax/java-driver/pulls/558","id":53499916,"html_url":"https://github.com/datastax/java-driver/pull/558","diff_url":"https://github.com/datastax/java-driver/pull/558.diff","patch_url":"https://github.com/datastax/java-driver/pull/558.patch","issue_url":"https://api.github.com/repos/datastax/java-driver/issues/558","number":558,"state":"open","locked":false,"title":"Add create alter drop keyspace statement builders","user":{"login":"ifesdjeen","id":12669,"avatar_url":"https://avatars.githubusercontent.com/u/12669?v=3","gravatar_id":"","url":"https://api.github.com/users/ifesdjeen","html_url":"https://github.com/ifesdjeen","followers_url":"https://api.github.com/users/ifesdjeen/followers","following_url":"https://api.github.com/users/ifesdjeen/following{/other_user}","gists_url":"https://api.github.com/users/ifesdjeen/gists{/gist_id}","starred_url":"https://api.github.com/users/ifesdjeen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ifesdjeen/subscriptions","organizations_url":"https://api.github.com/users/ifesdjeen/orgs","repos_url":"https://api.github.com/users/ifesdjeen/repos","events_url":"https://api.github.com/users/ifesdjeen/events{/privacy}","received_events_url":"https://api.github.com/users/ifesdjeen/received_events","type":"User","site_admin":false},"body":"As discussed offline with @adutra, backporting the `CREATE`, `DROP` and `ALTER` statement builders from Cassaforte, Clojure driver for Cassandra: https://github.com/clojurewerkz/cassaforte/tree/master/src/java/com/datastax/driver/core/schemabuilder \r\n\r\nI've tried to keep the code style, indentations used within statements as close to their `TABLE` counterparts.","created_at":"2015-12-13T13:31:02Z","updated_at":"2015-12-15T17:59:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2906a3450157485ce7d4dbc3835236fd5c82043c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/datastax/java-driver/pulls/558/commits","review_comments_url":"https://api.github.com/repos/datastax/java-driver/pulls/558/comments","review_comment_url":"https://api.github.com/repos/datastax/java-driver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/datastax/java-driver/issues/558/comments","statuses_url":"https://api.github.com/repos/datastax/java-driver/statuses/67588f49d7a3aa6a52abc320434ed6e977b3ba8e","head":{"label":"ifesdjeen:add-create-alter-drop-keyspace-statement-builders","ref":"add-create-alter-drop-keyspace-statement-builders","sha":"67588f49d7a3aa6a52abc320434ed6e977b3ba8e","user":{"login":"ifesdjeen","id":12669,"avatar_url":"https://avatars.githubusercontent.com/u/12669?v=3","gravatar_id":"","url":"https://api.github.com/users/ifesdjeen","html_url":"https://github.com/ifesdjeen","followers_url":"https://api.github.com/users/ifesdjeen/followers","following_url":"https://api.github.com/users/ifesdjeen/following{/other_user}","gists_url":"https://api.github.com/users/ifesdjeen/gists{/gist_id}","starred_url":"https://api.github.com/users/ifesdjeen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ifesdjeen/subscriptions","organizations_url":"https://api.github.com/users/ifesdjeen/orgs","repos_url":"https://api.github.com/users/ifesdjeen/repos","events_url":"https://api.github.com/users/ifesdjeen/events{/privacy}","received_events_url":"https://api.github.com/users/ifesdjeen/received_events","type":"User","site_admin":false},"repo":{"id":47917809,"name":"java-driver","full_name":"ifesdjeen/java-driver","owner":{"login":"ifesdjeen","id":12669,"avatar_url":"https://avatars.githubusercontent.com/u/12669?v=3","gravatar_id":"","url":"https://api.github.com/users/ifesdjeen","html_url":"https://github.com/ifesdjeen","followers_url":"https://api.github.com/users/ifesdjeen/followers","following_url":"https://api.github.com/users/ifesdjeen/following{/other_user}","gists_url":"https://api.github.com/users/ifesdjeen/gists{/gist_id}","starred_url":"https://api.github.com/users/ifesdjeen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ifesdjeen/subscriptions","organizations_url":"https://api.github.com/users/ifesdjeen/orgs","repos_url":"https://api.github.com/users/ifesdjeen/repos","events_url":"https://api.github.com/users/ifesdjeen/events{/privacy}","received_events_url":"https://api.github.com/users/ifesdjeen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ifesdjeen/java-driver","description":"DataStax Java Driver for Apache Cassandra","fork":true,"url":"https://api.github.com/repos/ifesdjeen/java-driver","forks_url":"https://api.github.com/repos/ifesdjeen/java-driver/forks","keys_url":"https://api.github.com/repos/ifesdjeen/java-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ifesdjeen/java-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ifesdjeen/java-driver/teams","hooks_url":"https://api.github.com/repos/ifesdjeen/java-driver/hooks","issue_events_url":"https://api.github.com/repos/ifesdjeen/java-driver/issues/events{/number}","events_url":"https://api.github.com/repos/ifesdjeen/java-driver/events","assignees_url":"https://api.github.com/repos/ifesdjeen/java-driver/assignees{/user}","branches_url":"https://api.github.com/repos/ifesdjeen/java-driver/branches{/branch}","tags_url":"https://api.github.com/repos/ifesdjeen/java-driver/tags","blobs_url":"https://api.github.com/repos/ifesdjeen/java-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ifesdjeen/java-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ifesdjeen/java-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/ifesdjeen/java-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ifesdjeen/java-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/ifesdjeen/java-driver/languages","stargazers_url":"https://api.github.com/repos/ifesdjeen/java-driver/stargazers","contributors_url":"https://api.github.com/repos/ifesdjeen/java-driver/contributors","subscribers_url":"https://api.github.com/repos/ifesdjeen/java-driver/subscribers","subscription_url":"https://api.github.com/repos/ifesdjeen/java-driver/subscription","commits_url":"https://api.github.com/repos/ifesdjeen/java-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/ifesdjeen/java-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/ifesdjeen/java-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/ifesdjeen/java-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/ifesdjeen/java-driver/contents/{+path}","compare_url":"https://api.github.com/repos/ifesdjeen/java-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ifesdjeen/java-driver/merges","archive_url":"https://api.github.com/repos/ifesdjeen/java-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ifesdjeen/java-driver/downloads","issues_url":"https://api.github.com/repos/ifesdjeen/java-driver/issues{/number}","pulls_url":"https://api.github.com/repos/ifesdjeen/java-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/ifesdjeen/java-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/ifesdjeen/java-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ifesdjeen/java-driver/labels{/name}","releases_url":"https://api.github.com/repos/ifesdjeen/java-driver/releases{/id}","created_at":"2015-12-13T12:15:04Z","updated_at":"2015-12-13T12:15:06Z","pushed_at":"2015-12-13T13:59:28Z","git_url":"git://github.com/ifesdjeen/java-driver.git","ssh_url":"git@github.com:ifesdjeen/java-driver.git","clone_url":"https://github.com/ifesdjeen/java-driver.git","svn_url":"https://github.com/ifesdjeen/java-driver","homepage":null,"size":17421,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"2.1"}},"base":{"label":"datastax:2.1","ref":"2.1","sha":"9a44f8a407b3e1bb7204dce76fbb966e5e845ee2","user":{"login":"datastax","id":573369,"avatar_url":"https://avatars.githubusercontent.com/u/573369?v=3","gravatar_id":"","url":"https://api.github.com/users/datastax","html_url":"https://github.com/datastax","followers_url":"https://api.github.com/users/datastax/followers","following_url":"https://api.github.com/users/datastax/following{/other_user}","gists_url":"https://api.github.com/users/datastax/gists{/gist_id}","starred_url":"https://api.github.com/users/datastax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/datastax/subscriptions","organizations_url":"https://api.github.com/users/datastax/orgs","repos_url":"https://api.github.com/users/datastax/repos","events_url":"https://api.github.com/users/datastax/events{/privacy}","received_events_url":"https://api.github.com/users/datastax/received_events","type":"Organization","site_admin":false},"repo":{"id":6765281,"name":"java-driver","full_name":"datastax/java-driver","owner":{"login":"datastax","id":573369,"avatar_url":"https://avatars.githubusercontent.com/u/573369?v=3","gravatar_id":"","url":"https://api.github.com/users/datastax","html_url":"https://github.com/datastax","followers_url":"https://api.github.com/users/datastax/followers","following_url":"https://api.github.com/users/datastax/following{/other_user}","gists_url":"https://api.github.com/users/datastax/gists{/gist_id}","starred_url":"https://api.github.com/users/datastax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/datastax/subscriptions","organizations_url":"https://api.github.com/users/datastax/orgs","repos_url":"https://api.github.com/users/datastax/repos","events_url":"https://api.github.com/users/datastax/events{/privacy}","received_events_url":"https://api.github.com/users/datastax/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/datastax/java-driver","description":"DataStax Java Driver for Apache Cassandra","fork":false,"url":"https://api.github.com/repos/datastax/java-driver","forks_url":"https://api.github.com/repos/datastax/java-driver/forks","keys_url":"https://api.github.com/repos/datastax/java-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/datastax/java-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/datastax/java-driver/teams","hooks_url":"https://api.github.com/repos/datastax/java-driver/hooks","issue_events_url":"https://api.github.com/repos/datastax/java-driver/issues/events{/number}","events_url":"https://api.github.com/repos/datastax/java-driver/events","assignees_url":"https://api.github.com/repos/datastax/java-driver/assignees{/user}","branches_url":"https://api.github.com/repos/datastax/java-driver/branches{/branch}","tags_url":"https://api.github.com/repos/datastax/java-driver/tags","blobs_url":"https://api.github.com/repos/datastax/java-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/datastax/java-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/datastax/java-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/datastax/java-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/datastax/java-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/datastax/java-driver/languages","stargazers_url":"https://api.github.com/repos/datastax/java-driver/stargazers","contributors_url":"https://api.github.com/repos/datastax/java-driver/contributors","subscribers_url":"https://api.github.com/repos/datastax/java-driver/subscribers","subscription_url":"https://api.github.com/repos/datastax/java-driver/subscription","commits_url":"https://api.github.com/repos/datastax/java-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/datastax/java-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/datastax/java-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/datastax/java-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/datastax/java-driver/contents/{+path}","compare_url":"https://api.github.com/repos/datastax/java-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/datastax/java-driver/merges","archive_url":"https://api.github.com/repos/datastax/java-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/datastax/java-driver/downloads","issues_url":"https://api.github.com/repos/datastax/java-driver/issues{/number}","pulls_url":"https://api.github.com/repos/datastax/java-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/datastax/java-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/datastax/java-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/datastax/java-driver/labels{/name}","releases_url":"https://api.github.com/repos/datastax/java-driver/releases{/id}","created_at":"2012-11-19T18:44:41Z","updated_at":"2015-12-15T12:14:32Z","pushed_at":"2015-12-15T12:49:28Z","git_url":"git://github.com/datastax/java-driver.git","ssh_url":"git@github.com:datastax/java-driver.git","clone_url":"https://github.com/datastax/java-driver.git","svn_url":"https://github.com/datastax/java-driver","homepage":null,"size":20053,"stargazers_count":544,"watchers_count":544,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":403,"mirror_url":null,"open_issues_count":38,"forks":403,"open_issues":38,"watchers":544,"default_branch":"2.1"}},"_links":{"self":{"href":"https://api.github.com/repos/datastax/java-driver/pulls/558"},"html":{"href":"https://github.com/datastax/java-driver/pull/558"},"issue":{"href":"https://api.github.com/repos/datastax/java-driver/issues/558"},"comments":{"href":"https://api.github.com/repos/datastax/java-driver/issues/558/comments"},"review_comments":{"href":"https://api.github.com/repos/datastax/java-driver/pulls/558/comments"},"review_comment":{"href":"https://api.github.com/repos/datastax/java-driver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/datastax/java-driver/pulls/558/commits"},"statuses":{"href":"https://api.github.com/repos/datastax/java-driver/statuses/67588f49d7a3aa6a52abc320434ed6e977b3ba8e"}}}}