{"action":"created","comment":{"url":"https://api.github.com/repos/digital-asset/daml/pulls/comments/273480630","pull_request_review_id":224388999,"id":273480630,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI3MzQ4MDYzMA==","diff_hunk":"@@ -380,3 +383,96 @@ The Java code generated for this variant is:\n     public Published(Long year, String publisher) { /* ... */ }\n     public Record toValue() { /* ... */ }\n   }\n+\n+Parameterized types\n+~~~~~~~~~~~~~~~~~~~\n+\n+The Java Code Generator uses Java Generic types to represent :ref:`DAML parameterized types <daml-ref-parameterized-types>`.\n+\n+Below is a DAML fragment defining the parameterized type ``Attribute`` for use by the ``BookAttribute`` type for modeling\n+the characteristics of the book.\n+\n+.. literalinclude:: ./code-snippets/ParameterizedTypes.daml\n+   :language: daml\n+   :lines: 3-11\n+   :caption: Com/Acme.daml\n+\n+A file Java file is generated for the ``Attribute`` data type that defines the Java Generic class:\n+\n+.. code-block:: java\n+  :caption: com/acme/Attribute.java\n+  :emphasize-lines: 3,8,10\n+\n+  package com.acme;\n+\n+  public class Attribute<a> {\n+    public final a value;\n+\n+    public Attribute(a value) { /* ... */  }\n+\n+    public Record toValue(Function<a, Value> toValuea) { /* ... */ }\n+\n+    public static <a> Attribute<a> fromValue(Value value$, Function<Value, a> fromValuea) { /* ... */ }\n+  }\n+\n+Serializing\n+\"\"\"\"\"\"\"\"\"\"\"\n+\n+To serialize an instance of the ``Attribute<a>`` data type, a function for creating the Ledger API equivalent of the attribute value\n+is passed to the ``toValue`` method as the ``fromValuea`` argument (see the above ``com/acme/Attribute.java`` source extract).\n+\n+Below is a Java fragment that serializes an attribute with a ``java.lang.Long`` value to the Ledger API representation using the *method reference*\n+``Int64::new`` to create a new instance of the Java Bindings value type.\n+\n+.. code-block:: java\n+\n+  Attribute<Long> pagesAttribute = new Attributes<>(42L);\n+\n+  Value serializedPages = pagesAttribute.toValue(Int64::new);\n+\n+See :ref:`DAML To Java Type Mapping <daml-codegen-java-primitive-types>` for the Java Bindings value types need to be created in the `fromValue`` method.","path":"docs/source/app-dev/bindings-java/codegen.rst","position":168,"original_position":168,"commit_id":"7c445df35f5591a38294b7925acef6557d204d12","original_commit_id":"7c445df35f5591a38294b7925acef6557d204d12","user":{"login":"gerolf-da","id":29121423,"node_id":"MDQ6VXNlcjI5MTIxNDIz","avatar_url":"https://avatars0.githubusercontent.com/u/29121423?v=4","gravatar_id":"","url":"https://api.github.com/users/gerolf-da","html_url":"https://github.com/gerolf-da","followers_url":"https://api.github.com/users/gerolf-da/followers","following_url":"https://api.github.com/users/gerolf-da/following{/other_user}","gists_url":"https://api.github.com/users/gerolf-da/gists{/gist_id}","starred_url":"https://api.github.com/users/gerolf-da/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gerolf-da/subscriptions","organizations_url":"https://api.github.com/users/gerolf-da/orgs","repos_url":"https://api.github.com/users/gerolf-da/repos","events_url":"https://api.github.com/users/gerolf-da/events{/privacy}","received_events_url":"https://api.github.com/users/gerolf-da/received_events","type":"User","site_admin":false},"body":"```suggestion\r\nSee :ref:`DAML To Java Type Mapping <daml-codegen-java-primitive-types>` for the Java Bindings value types need to be created in the ``fromValue`` method.\r\n```","created_at":"2019-04-09T13:06:52Z","updated_at":"2019-04-09T13:17:44Z","html_url":"https://github.com/digital-asset/daml/pull/290#discussion_r273480630","pull_request_url":"https://api.github.com/repos/digital-asset/daml/pulls/290","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/digital-asset/daml/pulls/comments/273480630"},"html":{"href":"https://github.com/digital-asset/daml/pull/290#discussion_r273480630"},"pull_request":{"href":"https://api.github.com/repos/digital-asset/daml/pulls/290"}}},"pull_request":{"url":"https://api.github.com/repos/digital-asset/daml/pulls/290","id":268360319,"node_id":"MDExOlB1bGxSZXF1ZXN0MjY4MzYwMzE5","html_url":"https://github.com/digital-asset/daml/pull/290","diff_url":"https://github.com/digital-asset/daml/pull/290.diff","patch_url":"https://github.com/digital-asset/daml/pull/290.patch","issue_url":"https://api.github.com/repos/digital-asset/daml/issues/290","number":290,"state":"open","locked":false,"title":"Fix #152 java-codegen: Document parameterized types.","user":{"login":"nicholassmith-da","id":47316213,"node_id":"MDQ6VXNlcjQ3MzE2MjEz","avatar_url":"https://avatars3.githubusercontent.com/u/47316213?v=4","gravatar_id":"","url":"https://api.github.com/users/nicholassmith-da","html_url":"https://github.com/nicholassmith-da","followers_url":"https://api.github.com/users/nicholassmith-da/followers","following_url":"https://api.github.com/users/nicholassmith-da/following{/other_user}","gists_url":"https://api.github.com/users/nicholassmith-da/gists{/gist_id}","starred_url":"https://api.github.com/users/nicholassmith-da/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicholassmith-da/subscriptions","organizations_url":"https://api.github.com/users/nicholassmith-da/orgs","repos_url":"https://api.github.com/users/nicholassmith-da/repos","events_url":"https://api.github.com/users/nicholassmith-da/events{/privacy}","received_events_url":"https://api.github.com/users/nicholassmith-da/received_events","type":"User","site_admin":false},"body":"Explain the sources that the Java Code Generator creates for\r\nparameterized DAML types including the implications for converting\r\nbetween Java Bindings Value types and Java native types.\r\n\r\nFirst version!","created_at":"2019-04-08T14:25:42Z","updated_at":"2019-04-09T13:17:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"87e68463c406d5d0a84a8bef9d86fb87ebe9bb61","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1297954469,"node_id":"MDU6TGFiZWwxMjk3OTU0NDY5","url":"https://api.github.com/repos/digital-asset/daml/labels/component/java-ecosystem","name":"component/java-ecosystem","color":"0fe50b","default":false}],"milestone":{"url":"https://api.github.com/repos/digital-asset/daml/milestones/3","html_url":"https://github.com/digital-asset/daml/milestone/3","labels_url":"https://api.github.com/repos/digital-asset/daml/milestones/3/labels","id":4187018,"node_id":"MDk6TWlsZXN0b25lNDE4NzAxOA==","number":3,"title":"Maintenance","description":"","creator":{"login":"cbaatz-da","id":26059252,"node_id":"MDQ6VXNlcjI2MDU5MjUy","avatar_url":"https://avatars2.githubusercontent.com/u/26059252?v=4","gravatar_id":"","url":"https://api.github.com/users/cbaatz-da","html_url":"https://github.com/cbaatz-da","followers_url":"https://api.github.com/users/cbaatz-da/followers","following_url":"https://api.github.com/users/cbaatz-da/following{/other_user}","gists_url":"https://api.github.com/users/cbaatz-da/gists{/gist_id}","starred_url":"https://api.github.com/users/cbaatz-da/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbaatz-da/subscriptions","organizations_url":"https://api.github.com/users/cbaatz-da/orgs","repos_url":"https://api.github.com/users/cbaatz-da/repos","events_url":"https://api.github.com/users/cbaatz-da/events{/privacy}","received_events_url":"https://api.github.com/users/cbaatz-da/received_events","type":"User","site_admin":false},"open_issues":51,"closed_issues":19,"state":"open","created_at":"2019-03-31T19:48:51Z","updated_at":"2019-04-09T08:48:50Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/digital-asset/daml/pulls/290/commits","review_comments_url":"https://api.github.com/repos/digital-asset/daml/pulls/290/comments","review_comment_url":"https://api.github.com/repos/digital-asset/daml/pulls/comments{/number}","comments_url":"https://api.github.com/repos/digital-asset/daml/issues/290/comments","statuses_url":"https://api.github.com/repos/digital-asset/daml/statuses/7c445df35f5591a38294b7925acef6557d204d12","head":{"label":"digital-asset:java-codegen-explain-parameterized-types","ref":"java-codegen-explain-parameterized-types","sha":"7c445df35f5591a38294b7925acef6557d204d12","user":{"login":"digital-asset","id":46327217,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ2MzI3MjE3","avatar_url":"https://avatars0.githubusercontent.com/u/46327217?v=4","gravatar_id":"","url":"https://api.github.com/users/digital-asset","html_url":"https://github.com/digital-asset","followers_url":"https://api.github.com/users/digital-asset/followers","following_url":"https://api.github.com/users/digital-asset/following{/other_user}","gists_url":"https://api.github.com/users/digital-asset/gists{/gist_id}","starred_url":"https://api.github.com/users/digital-asset/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digital-asset/subscriptions","organizations_url":"https://api.github.com/users/digital-asset/orgs","repos_url":"https://api.github.com/users/digital-asset/repos","events_url":"https://api.github.com/users/digital-asset/events{/privacy}","received_events_url":"https://api.github.com/users/digital-asset/received_events","type":"Organization","site_admin":false},"repo":{"id":178222328,"node_id":"MDEwOlJlcG9zaXRvcnkxNzgyMjIzMjg=","name":"daml","full_name":"digital-asset/daml","private":false,"owner":{"login":"digital-asset","id":46327217,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ2MzI3MjE3","avatar_url":"https://avatars0.githubusercontent.com/u/46327217?v=4","gravatar_id":"","url":"https://api.github.com/users/digital-asset","html_url":"https://github.com/digital-asset","followers_url":"https://api.github.com/users/digital-asset/followers","following_url":"https://api.github.com/users/digital-asset/following{/other_user}","gists_url":"https://api.github.com/users/digital-asset/gists{/gist_id}","starred_url":"https://api.github.com/users/digital-asset/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digital-asset/subscriptions","organizations_url":"https://api.github.com/users/digital-asset/orgs","repos_url":"https://api.github.com/users/digital-asset/repos","events_url":"https://api.github.com/users/digital-asset/events{/privacy}","received_events_url":"https://api.github.com/users/digital-asset/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/digital-asset/daml","description":"The DAML smart contract language","fork":false,"url":"https://api.github.com/repos/digital-asset/daml","forks_url":"https://api.github.com/repos/digital-asset/daml/forks","keys_url":"https://api.github.com/repos/digital-asset/daml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/digital-asset/daml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/digital-asset/daml/teams","hooks_url":"https://api.github.com/repos/digital-asset/daml/hooks","issue_events_url":"https://api.github.com/repos/digital-asset/daml/issues/events{/number}","events_url":"https://api.github.com/repos/digital-asset/daml/events","assignees_url":"https://api.github.com/repos/digital-asset/daml/assignees{/user}","branches_url":"https://api.github.com/repos/digital-asset/daml/branches{/branch}","tags_url":"https://api.github.com/repos/digital-asset/daml/tags","blobs_url":"https://api.github.com/repos/digital-asset/daml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/digital-asset/daml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/digital-asset/daml/git/refs{/sha}","trees_url":"https://api.github.com/repos/digital-asset/daml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/digital-asset/daml/statuses/{sha}","languages_url":"https://api.github.com/repos/digital-asset/daml/languages","stargazers_url":"https://api.github.com/repos/digital-asset/daml/stargazers","contributors_url":"https://api.github.com/repos/digital-asset/daml/contributors","subscribers_url":"https://api.github.com/repos/digital-asset/daml/subscribers","subscription_url":"https://api.github.com/repos/digital-asset/daml/subscription","commits_url":"https://api.github.com/repos/digital-asset/daml/commits{/sha}","git_commits_url":"https://api.github.com/repos/digital-asset/daml/git/commits{/sha}","comments_url":"https://api.github.com/repos/digital-asset/daml/comments{/number}","issue_comment_url":"https://api.github.com/repos/digital-asset/daml/issues/comments{/number}","contents_url":"https://api.github.com/repos/digital-asset/daml/contents/{+path}","compare_url":"https://api.github.com/repos/digital-asset/daml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/digital-asset/daml/merges","archive_url":"https://api.github.com/repos/digital-asset/daml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/digital-asset/daml/downloads","issues_url":"https://api.github.com/repos/digital-asset/daml/issues{/number}","pulls_url":"https://api.github.com/repos/digital-asset/daml/pulls{/number}","milestones_url":"https://api.github.com/repos/digital-asset/daml/milestones{/number}","notifications_url":"https://api.github.com/repos/digital-asset/daml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/digital-asset/daml/labels{/name}","releases_url":"https://api.github.com/repos/digital-asset/daml/releases{/id}","deployments_url":"https://api.github.com/repos/digital-asset/daml/deployments","created_at":"2019-03-28T14:38:37Z","updated_at":"2019-04-09T13:09:15Z","pushed_at":"2019-04-09T13:10:23Z","git_url":"git://github.com/digital-asset/daml.git","ssh_url":"git@github.com:digital-asset/daml.git","clone_url":"https://github.com/digital-asset/daml.git","svn_url":"https://github.com/digital-asset/daml","homepage":"https://daml.com/","size":19730,"stargazers_count":81,"watchers_count":81,"language":"Scala","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":16,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":198,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":16,"open_issues":198,"watchers":81,"default_branch":"master"}},"base":{"label":"digital-asset:master","ref":"master","sha":"098120e7a9810f403c72610b3a2a2f9d2a87bd3c","user":{"login":"digital-asset","id":46327217,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ2MzI3MjE3","avatar_url":"https://avatars0.githubusercontent.com/u/46327217?v=4","gravatar_id":"","url":"https://api.github.com/users/digital-asset","html_url":"https://github.com/digital-asset","followers_url":"https://api.github.com/users/digital-asset/followers","following_url":"https://api.github.com/users/digital-asset/following{/other_user}","gists_url":"https://api.github.com/users/digital-asset/gists{/gist_id}","starred_url":"https://api.github.com/users/digital-asset/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digital-asset/subscriptions","organizations_url":"https://api.github.com/users/digital-asset/orgs","repos_url":"https://api.github.com/users/digital-asset/repos","events_url":"https://api.github.com/users/digital-asset/events{/privacy}","received_events_url":"https://api.github.com/users/digital-asset/received_events","type":"Organization","site_admin":false},"repo":{"id":178222328,"node_id":"MDEwOlJlcG9zaXRvcnkxNzgyMjIzMjg=","name":"daml","full_name":"digital-asset/daml","private":false,"owner":{"login":"digital-asset","id":46327217,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ2MzI3MjE3","avatar_url":"https://avatars0.githubusercontent.com/u/46327217?v=4","gravatar_id":"","url":"https://api.github.com/users/digital-asset","html_url":"https://github.com/digital-asset","followers_url":"https://api.github.com/users/digital-asset/followers","following_url":"https://api.github.com/users/digital-asset/following{/other_user}","gists_url":"https://api.github.com/users/digital-asset/gists{/gist_id}","starred_url":"https://api.github.com/users/digital-asset/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/digital-asset/subscriptions","organizations_url":"https://api.github.com/users/digital-asset/orgs","repos_url":"https://api.github.com/users/digital-asset/repos","events_url":"https://api.github.com/users/digital-asset/events{/privacy}","received_events_url":"https://api.github.com/users/digital-asset/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/digital-asset/daml","description":"The DAML smart contract language","fork":false,"url":"https://api.github.com/repos/digital-asset/daml","forks_url":"https://api.github.com/repos/digital-asset/daml/forks","keys_url":"https://api.github.com/repos/digital-asset/daml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/digital-asset/daml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/digital-asset/daml/teams","hooks_url":"https://api.github.com/repos/digital-asset/daml/hooks","issue_events_url":"https://api.github.com/repos/digital-asset/daml/issues/events{/number}","events_url":"https://api.github.com/repos/digital-asset/daml/events","assignees_url":"https://api.github.com/repos/digital-asset/daml/assignees{/user}","branches_url":"https://api.github.com/repos/digital-asset/daml/branches{/branch}","tags_url":"https://api.github.com/repos/digital-asset/daml/tags","blobs_url":"https://api.github.com/repos/digital-asset/daml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/digital-asset/daml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/digital-asset/daml/git/refs{/sha}","trees_url":"https://api.github.com/repos/digital-asset/daml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/digital-asset/daml/statuses/{sha}","languages_url":"https://api.github.com/repos/digital-asset/daml/languages","stargazers_url":"https://api.github.com/repos/digital-asset/daml/stargazers","contributors_url":"https://api.github.com/repos/digital-asset/daml/contributors","subscribers_url":"https://api.github.com/repos/digital-asset/daml/subscribers","subscription_url":"https://api.github.com/repos/digital-asset/daml/subscription","commits_url":"https://api.github.com/repos/digital-asset/daml/commits{/sha}","git_commits_url":"https://api.github.com/repos/digital-asset/daml/git/commits{/sha}","comments_url":"https://api.github.com/repos/digital-asset/daml/comments{/number}","issue_comment_url":"https://api.github.com/repos/digital-asset/daml/issues/comments{/number}","contents_url":"https://api.github.com/repos/digital-asset/daml/contents/{+path}","compare_url":"https://api.github.com/repos/digital-asset/daml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/digital-asset/daml/merges","archive_url":"https://api.github.com/repos/digital-asset/daml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/digital-asset/daml/downloads","issues_url":"https://api.github.com/repos/digital-asset/daml/issues{/number}","pulls_url":"https://api.github.com/repos/digital-asset/daml/pulls{/number}","milestones_url":"https://api.github.com/repos/digital-asset/daml/milestones{/number}","notifications_url":"https://api.github.com/repos/digital-asset/daml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/digital-asset/daml/labels{/name}","releases_url":"https://api.github.com/repos/digital-asset/daml/releases{/id}","deployments_url":"https://api.github.com/repos/digital-asset/daml/deployments","created_at":"2019-03-28T14:38:37Z","updated_at":"2019-04-09T13:09:15Z","pushed_at":"2019-04-09T13:10:23Z","git_url":"git://github.com/digital-asset/daml.git","ssh_url":"git@github.com:digital-asset/daml.git","clone_url":"https://github.com/digital-asset/daml.git","svn_url":"https://github.com/digital-asset/daml","homepage":"https://daml.com/","size":19730,"stargazers_count":81,"watchers_count":81,"language":"Scala","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":16,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":198,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":16,"open_issues":198,"watchers":81,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/digital-asset/daml/pulls/290"},"html":{"href":"https://github.com/digital-asset/daml/pull/290"},"issue":{"href":"https://api.github.com/repos/digital-asset/daml/issues/290"},"comments":{"href":"https://api.github.com/repos/digital-asset/daml/issues/290/comments"},"review_comments":{"href":"https://api.github.com/repos/digital-asset/daml/pulls/290/comments"},"review_comment":{"href":"https://api.github.com/repos/digital-asset/daml/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/digital-asset/daml/pulls/290/commits"},"statuses":{"href":"https://api.github.com/repos/digital-asset/daml/statuses/7c445df35f5591a38294b7925acef6557d204d12"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"gerolf-da"}}