I vote for the second one. To improve readability I would add static imports (Alt+Enter on the method in Intellij Idea) and add an alias to a repeatedly used method ItemDtoMapper.generateItemDtoFromItem
like ItemDtoMapper.newItemDto
. The less symbols get into way the better.
static import ItemDtoMapper.generateItemDtoFromItem;
static import UserNameExtractor.getLoggedUser;
...
return newItemDto(
itemDao.saveItemAndReturn(
newItemDto(
itemDto,
newUser(userService.findByUserName(getLoggedUser())
))));
Or may be extracting the nested call makes it more readable:
ItemDao daoToSave = newItemDto(
newItemDto,
newUser(userService.findByUserName(getLoggedUser())
));
return newItemDto(itemDao.saveItemAndReturn(daoToSave));