Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
// add these bindings
install(new DefaultModule.Builder().tokenFormatter(RouteTokenFormatter.class).build());
public interface UserService {
String getUsername(int userId);
void saveUsername(int userId, String username);
Map<Integer, String> getUsers();
// Dummy implementation of a UserService
public class UserServiceImpl implements UserService {
private Map<Integer, String> usernames;
public UserServiceImpl() {
usernames = new HashMap<>();
usernames.put(1, "Arcbees");
usernames.put(2, "Joel");
usernames.put(3, "Olivier");
public String getUsername(int userId) {
return usernames.get(userId);
public void saveUsername(int userId, String username) {
usernames.put(userId, username);
public Map<Integer, String> getUsers() {
return usernames;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment