{"action":"created","issue":{"url":"https://api.github.com/repos/mapstruct/mapstruct/issues/600","labels_url":"https://api.github.com/repos/mapstruct/mapstruct/issues/600/labels{/name}","comments_url":"https://api.github.com/repos/mapstruct/mapstruct/issues/600/comments","events_url":"https://api.github.com/repos/mapstruct/mapstruct/issues/600/events","html_url":"https://github.com/mapstruct/mapstruct/issues/600","id":94469815,"number":600,"title":"Feature Request: Possibility to provide default value","user":{"login":"luxmeter","id":4019200,"avatar_url":"https://avatars.githubusercontent.com/u/4019200?v=3","gravatar_id":"","url":"https://api.github.com/users/luxmeter","html_url":"https://github.com/luxmeter","followers_url":"https://api.github.com/users/luxmeter/followers","following_url":"https://api.github.com/users/luxmeter/following{/other_user}","gists_url":"https://api.github.com/users/luxmeter/gists{/gist_id}","starred_url":"https://api.github.com/users/luxmeter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luxmeter/subscriptions","organizations_url":"https://api.github.com/users/luxmeter/orgs","repos_url":"https://api.github.com/users/luxmeter/repos","events_url":"https://api.github.com/users/luxmeter/events{/privacy}","received_events_url":"https://api.github.com/users/luxmeter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-07-11T12:37:40Z","updated_at":"2015-07-23T18:26:07Z","closed_at":null,"body":"Hi guys,\r\n\r\nFirst of all, I appreciate your work and I'm happy that MapStruct exists. Keep it up!\r\n\r\nTo my request:\r\nI've encountered a situation where I want to define a default value in case the source attribute is null.\r\nSomething like that:\r\n```\r\n@Mapper(target=\"countryCode\", source=\"country.code\", default=\"DE\")\r\n```\r\n\r\nI solved my problem through a workaround:\r\n```\r\n@Mapper(target=\"countryCode\", expression=\"java((source.getCountry() != null) ? source.getCountry().getCode() : \\\"DE\\\";)\")\r\n```\r\n\r\nWould be awesome if this code snippet could be generated automatically.\r\n\r\nThank you!\r\n"},"comment":{"url":"https://api.github.com/repos/mapstruct/mapstruct/issues/comments/124197627","html_url":"https://github.com/mapstruct/mapstruct/issues/600#issuecomment-124197627","issue_url":"https://api.github.com/repos/mapstruct/mapstruct/issues/600","id":124197627,"user":{"login":"luxmeter","id":4019200,"avatar_url":"https://avatars.githubusercontent.com/u/4019200?v=3","gravatar_id":"","url":"https://api.github.com/users/luxmeter","html_url":"https://github.com/luxmeter","followers_url":"https://api.github.com/users/luxmeter/followers","following_url":"https://api.github.com/users/luxmeter/following{/other_user}","gists_url":"https://api.github.com/users/luxmeter/gists{/gist_id}","starred_url":"https://api.github.com/users/luxmeter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luxmeter/subscriptions","organizations_url":"https://api.github.com/users/luxmeter/orgs","repos_url":"https://api.github.com/users/luxmeter/repos","events_url":"https://api.github.com/users/luxmeter/events{/privacy}","received_events_url":"https://api.github.com/users/luxmeter/received_events","type":"User","site_admin":false},"created_at":"2015-07-23T18:26:07Z","updated_at":"2015-07-23T18:26:07Z","body":"Hi,\r\n\r\nI decided to contribute and try to add the feature by myself. @agudian gave me already a little introduction. Let's see how far I come. I will inform you about my progress but will take some time...\r\n\r\nBR"}}