{"action":"created","comment":{"url":"https://api.github.com/repos/apache/metamodel/pulls/comments/60834460","id":60834460,"diff_hunk":"@@ -0,0 +1,37 @@\n+/**\r\n+ * Licensed to the Apache Software Foundation (ASF) under one\r\n+ * or more contributor license agreements.  See the NOTICE file\r\n+ * distributed with this work for additional information\r\n+ * regarding copyright ownership.  The ASF licenses this file\r\n+ * to you under the Apache License, Version 2.0 (the\r\n+ * \"License\"); you may not use this file except in compliance\r\n+ * with the License.  You may obtain a copy of the License at\r\n+ *\r\n+ *   http://www.apache.org/licenses/LICENSE-2.0\r\n+ *\r\n+ * Unless required by applicable law or agreed to in writing,\r\n+ * software distributed under the License is distributed on an\r\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n+ * KIND, either express or implied.  See the License for the\r\n+ * specific language governing permissions and limitations\r\n+ * under the License.\r\n+ */\r\n+package org.apache.metamodel.schema.builder;\r\n+\r\n+/**\r\n+ * A strategy that defines how columns are logically named. Such strategies are\r\n+ * mostly used when a particular datastore is not itself intrinsically\r\n+ * specifying the column name.\r\n+ */\r\n+public interface ColumnNamingStrategy {\r\n+\r\n+    /**\r\n+     * Provides the name to apply for a given column.\r\n+     * \r\n+     * @param ctx\r\n+     *            the context of the column naming taking place. This contains\r\n+     *            column index, intrinsic name etc. if available.\r\n+     * @return the name to provide to the column.\r\n+     */\r\n+    public String getNextColumnName(ColumnNamingContext ctx);\r","path":"core/src/main/java/org/apache/metamodel/schema/builder/ColumnNamingStrategy.java","position":36,"original_position":36,"commit_id":"0da8f1a1cb9fa8bfe87eb73f38df047d111e196d","original_commit_id":"0da8f1a1cb9fa8bfe87eb73f38df047d111e196d","user":{"login":"kaspersorensen","id":291450,"avatar_url":"https://avatars.githubusercontent.com/u/291450?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspersorensen","html_url":"https://github.com/kaspersorensen","followers_url":"https://api.github.com/users/kaspersorensen/followers","following_url":"https://api.github.com/users/kaspersorensen/following{/other_user}","gists_url":"https://api.github.com/users/kaspersorensen/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspersorensen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspersorensen/subscriptions","organizations_url":"https://api.github.com/users/kaspersorensen/orgs","repos_url":"https://api.github.com/users/kaspersorensen/repos","events_url":"https://api.github.com/users/kaspersorensen/events{/privacy}","received_events_url":"https://api.github.com/users/kaspersorensen/received_events","type":"User","site_admin":false},"body":"I'm wondering if this method should reside here or in some object that is scoped just for the individual table. Because right now the interface seems to be global fir many tables but implementations typically need state which is scoped only for the duration of naming a single table.","created_at":"2016-04-23T20:24:40Z","updated_at":"2016-04-23T20:24:40Z","html_url":"https://github.com/apache/metamodel/pull/96#discussion_r60834460","pull_request_url":"https://api.github.com/repos/apache/metamodel/pulls/96","_links":{"self":{"href":"https://api.github.com/repos/apache/metamodel/pulls/comments/60834460"},"html":{"href":"https://github.com/apache/metamodel/pull/96#discussion_r60834460"},"pull_request":{"href":"https://api.github.com/repos/apache/metamodel/pulls/96"}}},"pull_request":{"url":"https://api.github.com/repos/apache/metamodel/pulls/96","id":67583746,"html_url":"https://github.com/apache/metamodel/pull/96","diff_url":"https://github.com/apache/metamodel/pull/96.diff","patch_url":"https://github.com/apache/metamodel/pull/96.patch","issue_url":"https://api.github.com/repos/apache/metamodel/issues/96","number":96,"state":"open","locked":false,"title":"(draft) METAMODEL-244","user":{"login":"kaspersorensen","id":291450,"avatar_url":"https://avatars.githubusercontent.com/u/291450?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspersorensen","html_url":"https://github.com/kaspersorensen","followers_url":"https://api.github.com/users/kaspersorensen/followers","following_url":"https://api.github.com/users/kaspersorensen/following{/other_user}","gists_url":"https://api.github.com/users/kaspersorensen/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspersorensen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspersorensen/subscriptions","organizations_url":"https://api.github.com/users/kaspersorensen/orgs","repos_url":"https://api.github.com/users/kaspersorensen/repos","events_url":"https://api.github.com/users/kaspersorensen/events{/privacy}","received_events_url":"https://api.github.com/users/kaspersorensen/received_events","type":"User","site_admin":false},"body":"I wanted to give a shot at fixing METAMODEL-244 so here goes.\r\n\r\nI made available a strategy interface for column naming, which I implemented in a few different ways, and created a default delegating strategy as well. It's implemented in the 'fixedwidth' module only for now.\r\n\r\nI also managed to fix something which I've encountered a few times before, but newer got around to report as an issue: The fact that it is annoying that you sometimes get duplicated column names for CSV files and such. That should rarely be allowed, so I implemented a strategy for renaming those duplicated column names automatically.\r\n\r\nI'd like a review if anyone is willing. If you agree that the approach taken is good I will happily also apply it in the excel and csv module. It would be quite easy I think actually.","created_at":"2016-04-22T22:54:43Z","updated_at":"2016-04-23T20:24:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fb422e8201c9aed4b2dc64a01e7cc44d9c2ef25e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/metamodel/pulls/96/commits","review_comments_url":"https://api.github.com/repos/apache/metamodel/pulls/96/comments","review_comment_url":"https://api.github.com/repos/apache/metamodel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/metamodel/issues/96/comments","statuses_url":"https://api.github.com/repos/apache/metamodel/statuses/0da8f1a1cb9fa8bfe87eb73f38df047d111e196d","head":{"label":"kaspersorensen:METAMODEL-244","ref":"METAMODEL-244","sha":"0da8f1a1cb9fa8bfe87eb73f38df047d111e196d","user":{"login":"kaspersorensen","id":291450,"avatar_url":"https://avatars.githubusercontent.com/u/291450?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspersorensen","html_url":"https://github.com/kaspersorensen","followers_url":"https://api.github.com/users/kaspersorensen/followers","following_url":"https://api.github.com/users/kaspersorensen/following{/other_user}","gists_url":"https://api.github.com/users/kaspersorensen/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspersorensen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspersorensen/subscriptions","organizations_url":"https://api.github.com/users/kaspersorensen/orgs","repos_url":"https://api.github.com/users/kaspersorensen/repos","events_url":"https://api.github.com/users/kaspersorensen/events{/privacy}","received_events_url":"https://api.github.com/users/kaspersorensen/received_events","type":"User","site_admin":false},"repo":{"id":37382170,"name":"metamodel","full_name":"kaspersorensen/metamodel","owner":{"login":"kaspersorensen","id":291450,"avatar_url":"https://avatars.githubusercontent.com/u/291450?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspersorensen","html_url":"https://github.com/kaspersorensen","followers_url":"https://api.github.com/users/kaspersorensen/followers","following_url":"https://api.github.com/users/kaspersorensen/following{/other_user}","gists_url":"https://api.github.com/users/kaspersorensen/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspersorensen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspersorensen/subscriptions","organizations_url":"https://api.github.com/users/kaspersorensen/orgs","repos_url":"https://api.github.com/users/kaspersorensen/repos","events_url":"https://api.github.com/users/kaspersorensen/events{/privacy}","received_events_url":"https://api.github.com/users/kaspersorensen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kaspersorensen/metamodel","description":"Mirror of Apache Metamodel","fork":true,"url":"https://api.github.com/repos/kaspersorensen/metamodel","forks_url":"https://api.github.com/repos/kaspersorensen/metamodel/forks","keys_url":"https://api.github.com/repos/kaspersorensen/metamodel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kaspersorensen/metamodel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kaspersorensen/metamodel/teams","hooks_url":"https://api.github.com/repos/kaspersorensen/metamodel/hooks","issue_events_url":"https://api.github.com/repos/kaspersorensen/metamodel/issues/events{/number}","events_url":"https://api.github.com/repos/kaspersorensen/metamodel/events","assignees_url":"https://api.github.com/repos/kaspersorensen/metamodel/assignees{/user}","branches_url":"https://api.github.com/repos/kaspersorensen/metamodel/branches{/branch}","tags_url":"https://api.github.com/repos/kaspersorensen/metamodel/tags","blobs_url":"https://api.github.com/repos/kaspersorensen/metamodel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kaspersorensen/metamodel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kaspersorensen/metamodel/git/refs{/sha}","trees_url":"https://api.github.com/repos/kaspersorensen/metamodel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kaspersorensen/metamodel/statuses/{sha}","languages_url":"https://api.github.com/repos/kaspersorensen/metamodel/languages","stargazers_url":"https://api.github.com/repos/kaspersorensen/metamodel/stargazers","contributors_url":"https://api.github.com/repos/kaspersorensen/metamodel/contributors","subscribers_url":"https://api.github.com/repos/kaspersorensen/metamodel/subscribers","subscription_url":"https://api.github.com/repos/kaspersorensen/metamodel/subscription","commits_url":"https://api.github.com/repos/kaspersorensen/metamodel/commits{/sha}","git_commits_url":"https://api.github.com/repos/kaspersorensen/metamodel/git/commits{/sha}","comments_url":"https://api.github.com/repos/kaspersorensen/metamodel/comments{/number}","issue_comment_url":"https://api.github.com/repos/kaspersorensen/metamodel/issues/comments{/number}","contents_url":"https://api.github.com/repos/kaspersorensen/metamodel/contents/{+path}","compare_url":"https://api.github.com/repos/kaspersorensen/metamodel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kaspersorensen/metamodel/merges","archive_url":"https://api.github.com/repos/kaspersorensen/metamodel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kaspersorensen/metamodel/downloads","issues_url":"https://api.github.com/repos/kaspersorensen/metamodel/issues{/number}","pulls_url":"https://api.github.com/repos/kaspersorensen/metamodel/pulls{/number}","milestones_url":"https://api.github.com/repos/kaspersorensen/metamodel/milestones{/number}","notifications_url":"https://api.github.com/repos/kaspersorensen/metamodel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kaspersorensen/metamodel/labels{/name}","releases_url":"https://api.github.com/repos/kaspersorensen/metamodel/releases{/id}","deployments_url":"https://api.github.com/repos/kaspersorensen/metamodel/deployments","created_at":"2015-06-13T18:05:00Z","updated_at":"2015-06-13T18:05:02Z","pushed_at":"2016-04-22T22:50:36Z","git_url":"git://github.com/kaspersorensen/metamodel.git","ssh_url":"git@github.com:kaspersorensen/metamodel.git","clone_url":"https://github.com/kaspersorensen/metamodel.git","svn_url":"https://github.com/kaspersorensen/metamodel","homepage":null,"size":4040,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"820b1f2b0be6462281321758a4a167965ec12ea7","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":11943595,"name":"metamodel","full_name":"apache/metamodel","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/metamodel","description":"Mirror of Apache Metamodel","fork":false,"url":"https://api.github.com/repos/apache/metamodel","forks_url":"https://api.github.com/repos/apache/metamodel/forks","keys_url":"https://api.github.com/repos/apache/metamodel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/metamodel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/metamodel/teams","hooks_url":"https://api.github.com/repos/apache/metamodel/hooks","issue_events_url":"https://api.github.com/repos/apache/metamodel/issues/events{/number}","events_url":"https://api.github.com/repos/apache/metamodel/events","assignees_url":"https://api.github.com/repos/apache/metamodel/assignees{/user}","branches_url":"https://api.github.com/repos/apache/metamodel/branches{/branch}","tags_url":"https://api.github.com/repos/apache/metamodel/tags","blobs_url":"https://api.github.com/repos/apache/metamodel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/metamodel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/metamodel/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/metamodel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/metamodel/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/metamodel/languages","stargazers_url":"https://api.github.com/repos/apache/metamodel/stargazers","contributors_url":"https://api.github.com/repos/apache/metamodel/contributors","subscribers_url":"https://api.github.com/repos/apache/metamodel/subscribers","subscription_url":"https://api.github.com/repos/apache/metamodel/subscription","commits_url":"https://api.github.com/repos/apache/metamodel/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/metamodel/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/metamodel/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/metamodel/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/metamodel/contents/{+path}","compare_url":"https://api.github.com/repos/apache/metamodel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/metamodel/merges","archive_url":"https://api.github.com/repos/apache/metamodel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/metamodel/downloads","issues_url":"https://api.github.com/repos/apache/metamodel/issues{/number}","pulls_url":"https://api.github.com/repos/apache/metamodel/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/metamodel/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/metamodel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/metamodel/labels{/name}","releases_url":"https://api.github.com/repos/apache/metamodel/releases{/id}","deployments_url":"https://api.github.com/repos/apache/metamodel/deployments","created_at":"2013-08-07T07:00:14Z","updated_at":"2016-02-07T16:03:20Z","pushed_at":"2016-04-22T22:54:44Z","git_url":"git://github.com/apache/metamodel.git","ssh_url":"git@github.com:apache/metamodel.git","clone_url":"https://github.com/apache/metamodel.git","svn_url":"https://github.com/apache/metamodel","homepage":null,"size":4736,"stargazers_count":48,"watchers_count":48,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":47,"mirror_url":"git://git.apache.org/metamodel.git","open_issues_count":2,"forks":47,"open_issues":2,"watchers":48,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/metamodel/pulls/96"},"html":{"href":"https://github.com/apache/metamodel/pull/96"},"issue":{"href":"https://api.github.com/repos/apache/metamodel/issues/96"},"comments":{"href":"https://api.github.com/repos/apache/metamodel/issues/96/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/metamodel/pulls/96/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/metamodel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/metamodel/pulls/96/commits"},"statuses":{"href":"https://api.github.com/repos/apache/metamodel/statuses/0da8f1a1cb9fa8bfe87eb73f38df047d111e196d"}}}}