This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class D_DependencyInversionSolution { | |
private static class AuthenticateLogin { | |
private final Authentication authentication; | |
private AuthenticateLogin(Authentication authentication) { | |
this.authentication = authentication; | |
} | |
public boolean login(User user){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class D_DependencyInversionSolution { | |
@AllArgsConstructor | |
private static class AuthenticateLogin { | |
private final Authentication authentication; | |
public boolean login(User user){ | |
return authentication.login(user); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class D_DependencyInversionProblem { | |
@AllArgsConstructor | |
private static class AuthenticateLogin { | |
public boolean login(User user){ | |
AuthenticationLinkedin authentication = new AuthenticationLinkedin(); | |
return authentication.login(user); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class I_InterfaceSegregationSolution { | |
public interface Car { | |
void openDoor(); | |
} | |
public interface ElectricCar { | |
void charge(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class I_InterfaceSegregationProblem { | |
public interface Car { | |
void charge(); | |
void openDoor(); | |
} | |
public static class Fiesta implements Car { | |
@Override | |
public void charge() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class L_LiskovSubstituitionProblem { | |
@Getter | |
@Setter | |
private static class BasicAccount { | |
protected double balance = 0; | |
public void yield() { | |
this.balance += (this.balance * 0.15); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class O_OpenClosedSolution { | |
@AllArgsConstructor | |
private static class AuthenticateLogin { | |
private Authentication authentication; | |
public boolean login(User user){ | |
return authentication.login(user); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class O_OpenClosedSolution { | |
private interface Authentication { | |
boolean login(User user); | |
} | |
private static class AuthenticationLinkedin implements Authentication { | |
@Override | |
public boolean login(User user) { | |
//autêntica o login com o Oauth Linkedin. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class O_OpenClosedProblem { | |
private static class AuthenticateLogin{ | |
public boolean login(User user, String provider){ | |
ConnectionDAO connectionDAO = new ConnectionDAO("root", ""); | |
Connection connection = connectionDAO.createConnection(); | |
if(provider.equalsIgnoreCase("Linkedin")){ | |
//autêntica o login com o Oauth Linkedin | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class S_SingleResponsabilitySolution { | |
private static class AuthenticateLogin { | |
public boolean login(User user) { | |
ConnectionDAO connectionDAO = new ConnectionDAO("root", ""); | |
Connection connection = connectionDAO.createConnection(); | |
//realiza o login do usuário no sistema | |
} | |
} | |
} |
NewerOlder