@Test public void testConvertTo() throws Exception { User user = new User(); Set<Role> roles = Sets.newHashSet(new Role(1), new Role(2)); user.setRoles(roles); UserResource userResource = mapper.map(user, UserResource.class); assertThat(userResource.getRoles(), is(Arrays.asList(1, 2))); }
@Override public Integer convertTo(Role source, Integer destination) { if (source == null) { return null; } return source.getId(); }
RoleToRoleIdConverter extends DozerConverter<Role, Integer> { @Override public Integer convertTo(Role source, Integer destination) { if (source == null) { return null; } return source.getId(); } }
RoleToRoleIdConverter extends DozerConverter<Role, Integer> { @Override public Integer convertTo(Role source, Integer destination) { if (source == null) { return null; } return source.getId(); } RoleToRoleIdConverter(); }
RoleToRoleIdConverter extends DozerConverter<Role, Integer> { @Override public Integer convertTo(Role source, Integer destination) { if (source == null) { return null; } return source.getId(); } RoleToRoleIdConverter(); @Override Integer convertTo(Role source, Integer destination); @Override Role convertFrom(Integer source, Role destination); }
RoleToRoleIdConverter extends DozerConverter<Role, Integer> { @Override public Integer convertTo(Role source, Integer destination) { if (source == null) { return null; } return source.getId(); } RoleToRoleIdConverter(); @Override Integer convertTo(Role source, Integer destination); @Override Role convertFrom(Integer source, Role destination);  }