{"action":"created","issue":{"url":"https://api.github.com/repos/jdbi/jdbi/issues/282","repository_url":"https://api.github.com/repos/jdbi/jdbi","labels_url":"https://api.github.com/repos/jdbi/jdbi/issues/282/labels{/name}","comments_url":"https://api.github.com/repos/jdbi/jdbi/issues/282/comments","events_url":"https://api.github.com/repos/jdbi/jdbi/issues/282/events","html_url":"https://github.com/jdbi/jdbi/issues/282","id":135572754,"number":282,"title":"For JDBI 3 to support Kotlin, need plugin points...","user":{"login":"apatrida","id":182340,"avatar_url":"https://avatars.githubusercontent.com/u/182340?v=3","gravatar_id":"","url":"https://api.github.com/users/apatrida","html_url":"https://github.com/apatrida","followers_url":"https://api.github.com/users/apatrida/followers","following_url":"https://api.github.com/users/apatrida/following{/other_user}","gists_url":"https://api.github.com/users/apatrida/gists{/gist_id}","starred_url":"https://api.github.com/users/apatrida/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apatrida/subscriptions","organizations_url":"https://api.github.com/users/apatrida/orgs","repos_url":"https://api.github.com/users/apatrida/repos","events_url":"https://api.github.com/users/apatrida/events{/privacy}","received_events_url":"https://api.github.com/users/apatrida/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jdbi/jdbi/labels/feature","name":"feature","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/jdbi/jdbi/milestones/2","html_url":"https://github.com/jdbi/jdbi/milestones/JDBI%203","labels_url":"https://api.github.com/repos/jdbi/jdbi/milestones/2/labels","id":382959,"number":2,"title":"JDBI 3","description":"Bucket for issues that should be in JDBI 3","creator":{"login":"stevenschlansker","id":129097,"avatar_url":"https://avatars.githubusercontent.com/u/129097?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenschlansker","html_url":"https://github.com/stevenschlansker","followers_url":"https://api.github.com/users/stevenschlansker/followers","following_url":"https://api.github.com/users/stevenschlansker/following{/other_user}","gists_url":"https://api.github.com/users/stevenschlansker/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenschlansker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenschlansker/subscriptions","organizations_url":"https://api.github.com/users/stevenschlansker/orgs","repos_url":"https://api.github.com/users/stevenschlansker/repos","events_url":"https://api.github.com/users/stevenschlansker/events{/privacy}","received_events_url":"https://api.github.com/users/stevenschlansker/received_events","type":"User","site_admin":false},"open_issues":22,"closed_issues":45,"state":"open","created_at":"2013-07-20T23:48:16Z","updated_at":"2016-02-23T01:33:28Z","due_on":null,"closed_at":null},"comments":26,"created_at":"2016-02-22T23:00:42Z","updated_at":"2016-02-23T18:33:12Z","closed_at":null,"body":"Kotlin has a lot of type information available at runtime, so if we can write a Kotlin plugin for JDBI we can take advantage of that information.\r\n\r\nI'll write the plugin, if you add extension points.  \r\n\r\nThings in Kotlin, related to JDBI:\r\n\r\n* like Java 8, we have parameter names, but in a different way.  So if the non annotated parameters can have a specific object mapper instead of just DefaultObjectMapper, we can use ours instead.   We can detect a Kotlin class and apply logic, otherwise fallback to the other DefaultObjectMapper.\r\n* we know if a property or parameter is nullable or not, so we can do error checking on required vs. optional parameters.\r\n* for data classes, all properties are also in the constructor, and normally we do not have a default constructor, so we can use the names of incoming parameters (i.e. fields in the query results) to pick the constructor.\r\n* we have copy constructors in data classes so anywhere we want to clone or make a slight modification to a immutable class we can copy it while changing the set list of fields.\r\n* we have optional parameters, and can detect when they exist, and can call using or omitting them (call by name)\r\n* for normal classes we can also look at the list of constructors and parameter names and try to make a best fit\r\n* we can reify generic parameters for inline functions so some methods can be simplified, we can do this as an extension function to add variations of API that do not need the class passed in as parameters (i.e. `DBI.open(SomeClass)` could infer `SomeClass` from the left side of the assignment).  I think our function parameter types also have full generic information in the metadata when viewed through reflection, same for return type.  I'll have to check that one, I think reflection can read it, but isn't reified.\r\n* we have default methods for interfaces, but not sure they are done the same as Java 8 ones (they copy into the first level of the class hierarchy that implements the interface I think, not sure they exist in the interface bytecode itself)\r\n* we have lambdas, function classes, etc. and can treat a parameter that is an interface with a single method as a lambda as well (automatic conversion).  \r\n\r\nSo given that, we should be able to help with `SqlObject` building to help decide binding by parameter name, and if things are optional coming in.  For results (I think we can do this already without changes) we can bind the results to classes or class hierarchies given that we can see names nicely, pick constructors besides the default,  take advantage of knowing about default values (for non nullable things), which parameters are really required, etc.  \r\n\r\nWhere else can we fit in?   and maybe a first early step is the `SqlObject` change for the default binder.  And then a result set binder, and a way to make it the default (I seem to remember it could be set per class as an annotation, but here we would want one general default to apply).  Other places we can extend?"},"comment":{"url":"https://api.github.com/repos/jdbi/jdbi/issues/comments/187831855","html_url":"https://github.com/jdbi/jdbi/issues/282#issuecomment-187831855","issue_url":"https://api.github.com/repos/jdbi/jdbi/issues/282","id":187831855,"user":{"login":"apatrida","id":182340,"avatar_url":"https://avatars.githubusercontent.com/u/182340?v=3","gravatar_id":"","url":"https://api.github.com/users/apatrida","html_url":"https://github.com/apatrida","followers_url":"https://api.github.com/users/apatrida/followers","following_url":"https://api.github.com/users/apatrida/following{/other_user}","gists_url":"https://api.github.com/users/apatrida/gists{/gist_id}","starred_url":"https://api.github.com/users/apatrida/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apatrida/subscriptions","organizations_url":"https://api.github.com/users/apatrida/orgs","repos_url":"https://api.github.com/users/apatrida/repos","events_url":"https://api.github.com/users/apatrida/events{/privacy}","received_events_url":"https://api.github.com/users/apatrida/received_events","type":"User","site_admin":false},"created_at":"2016-02-23T18:33:12Z","updated_at":"2016-02-23T18:33:12Z","body":"thanks for the help."}}