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_SingleResponsabilityProblem { | |
@Getter | |
@Setter | |
private static class Employee { | |
private Long id; | |
private String name; | |
private double salary; | |
private String jobTitle; | |
private static final String URL = "jdbc:mysql://localhost:3306/employee?useSSL=false"; |
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 ConnectionDAO { | |
private Properties connectionProps; | |
private Connection conn; | |
private static final String URL = "jdbc:mysql://localhost:3306/employee?useSSL=false"; | |
private ConnectionDAO(String username, String password) { | |
connectionProps = new Properties(); |
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 { | |
@Getter | |
@Setter | |
private static class User { | |
private String email; | |
private String password; | |
} | |
@Getter | |
@Setter |
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 | |
} | |
} | |
} |
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 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_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 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 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 I_InterfaceSegregationSolution { | |
public interface Car { | |
void openDoor(); | |
} | |
public interface ElectricCar { | |
void charge(); | |
} |
OlderNewer