Skip to content

Instantly share code, notes, and snippets.

@marciojrtorres
Created August 5, 2013 23:04
Show Gist options
  • Save marciojrtorres/6160446 to your computer and use it in GitHub Desktop.
Save marciojrtorres/6160446 to your computer and use it in GitHub Desktop.
Para programar por intenção devemos expor a intenção
// as classes em negrito não existem ainda
public class CreditoService {
public CreditoCheck checaCredito(TipoDocumento tipo, String documento) {
CreditoCheck creditoCheck = null;
if (tipo == TipoDocumento.CPF) {
creditoCheck = CreditoCheck.fromDivida(ws.checaCPF(documento));
} else if (tipo == TipoDocumento.RG) {
creditoCheck = CreditoCheck.fromDivida(ws.checaRG(documento));
}
return creditoCheck;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment