{"action":"created","issue":{"url":"https://api.github.com/repos/square/javapoet/issues/198","labels_url":"https://api.github.com/repos/square/javapoet/issues/198/labels{/name}","comments_url":"https://api.github.com/repos/square/javapoet/issues/198/comments","events_url":"https://api.github.com/repos/square/javapoet/issues/198/events","html_url":"https://github.com/square/javapoet/pull/198","id":55216437,"number":198,"title":"adding configurable indent","user":{"login":"pwittchen","id":695319,"avatar_url":"https://avatars.githubusercontent.com/u/695319?v=3","gravatar_id":"","url":"https://api.github.com/users/pwittchen","html_url":"https://github.com/pwittchen","followers_url":"https://api.github.com/users/pwittchen/followers","following_url":"https://api.github.com/users/pwittchen/following{/other_user}","gists_url":"https://api.github.com/users/pwittchen/gists{/gist_id}","starred_url":"https://api.github.com/users/pwittchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwittchen/subscriptions","organizations_url":"https://api.github.com/users/pwittchen/orgs","repos_url":"https://api.github.com/users/pwittchen/repos","events_url":"https://api.github.com/users/pwittchen/events{/privacy}","received_events_url":"https://api.github.com/users/pwittchen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-01-22T22:11:43Z","updated_at":"2015-01-24T14:23:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/square/javapoet/pulls/198","html_url":"https://github.com/square/javapoet/pull/198","diff_url":"https://github.com/square/javapoet/pull/198.diff","patch_url":"https://github.com/square/javapoet/pull/198.patch"},"body":"Hi,\r\n\r\nI have added configurable indent. It solves issue #106 . Indent can be configured in `JavaPoet` class (old `JavaWriter` class). Exemplary usage of the configurable indent is presented in the following code snippet:\r\n```java\r\nnew JavaPoet(new Indent().level(4));\r\n```\r\n\r\nIn addition, I've added appropriate Unit Tests verifying behavior of the library with new functionality.\r\nI wanted to make code clean and as abstract as possible.\r\n\r\nI hope it would be useful for you.\r\n\r\nRegards,\r\nPiotr "},"comment":{"url":"https://api.github.com/repos/square/javapoet/issues/comments/71319126","html_url":"https://github.com/square/javapoet/pull/198#issuecomment-71319126","issue_url":"https://api.github.com/repos/square/javapoet/issues/198","id":71319126,"user":{"login":"pwittchen","id":695319,"avatar_url":"https://avatars.githubusercontent.com/u/695319?v=3","gravatar_id":"","url":"https://api.github.com/users/pwittchen","html_url":"https://github.com/pwittchen","followers_url":"https://api.github.com/users/pwittchen/followers","following_url":"https://api.github.com/users/pwittchen/following{/other_user}","gists_url":"https://api.github.com/users/pwittchen/gists{/gist_id}","starred_url":"https://api.github.com/users/pwittchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwittchen/subscriptions","organizations_url":"https://api.github.com/users/pwittchen/orgs","repos_url":"https://api.github.com/users/pwittchen/repos","events_url":"https://api.github.com/users/pwittchen/events{/privacy}","received_events_url":"https://api.github.com/users/pwittchen/received_events","type":"User","site_admin":false},"created_at":"2015-01-24T14:23:18Z","updated_at":"2015-01-24T14:23:18Z","body":"I've updated code. Now, API looks as @swankjesse proposed:\r\n```java\r\nJavaPoet javaPoet = new JavaPoet();\r\njavaPoet.setIndent(\"  \");\r\n```\r\n\r\nDrawback of this solution is the fact that `indent` variable in `JavaPoet` class is mutable and `setIndent()` method have to be called before `add()` method if we want to have different indentation than default."}}