Skip to content

Instantly share code, notes, and snippets.

@jordansjones
Created December 11, 2012 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordansjones/4261689 to your computer and use it in GitHub Desktop.
Save jordansjones/4261689 to your computer and use it in GitHub Desktop.
This is a stupid idea...
@Post("/account/{accountId}/changeEmail")
public class ChangeEmailRequest {
private int accountId;
private String newEmailAddress;
}
// Then the Handler
public class AccountService {
public void changeEmail(final int accountId, final String email) {
// ...
}
@Subscribe
public void handleChangeEmailRequest(final ChangeEmailRequest request) {
this.changeEmail(request.accountId, request.newEmailAddress);
}
}
// Instead of
@Path("/account")
public class Account {
private AccountService accountService;
@POST("/{accountId}/changeEmail")
public void changeEmail(int accountId, String newEmailAddress) {
accountService.changeEmail(accountId, newEmailAddress);
}
}
public class AccountService {
public void changeEmail(final int accountId, final String email) {
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment