-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JDBC 라이브러리] 효오 미션 제출합니다. #33
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
안녕하세요 효오! 리뷰어 하비입니다.
기본적으로 잘 짜주셨네요. 💯
살짝 리펙토링 포인트가 보여 몇 가지 개선 포인트를 남겨보았습니다.
확인해 보시고 답변이나 반영 부탁드립니다:)
this.dataSource = dataSource; | ||
} | ||
|
||
public T queryForObject(String sql, PreparedStatementSetter pstmtSetter, RowMapper<T> rowMapper) throws SQLException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반환값이 Optional
이면 외부에서 사용하기 한결 더 편리해 보입니다.
return query(sql, pstmtSetter, rowMapper).get(0); | ||
} | ||
|
||
public List<T> query(String sql, PreparedStatementSetter pstmtSetter, RowMapper<T> rowMapper) throws SQLException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query()
, update()
메서드에 중복 코드가 존재합니다. 인터페이스를 구현하여 할당 시키는 부분만 다른데요. 중복코드 제거해서 하나로 통일할 수 잇지 않을까요?ㅎㅎ
import java.sql.SQLException; | ||
|
||
@FunctionalInterface | ||
public interface PreparedStatementSetter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
import java.sql.SQLException; | ||
|
||
@FunctionalInterface | ||
public interface RowMapper<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
- T -> Optional<T>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
피드백 반영을 잘해주셨습니다 👍
미션 진행하느라 고생하셨습니다 :)
안녕하세요! 영재님
이번에 jdbc 미션을 진행하면서 그 동안 자바 기능을 많이 활용하지 못했다고 느꼈고, 자바에 대해 다시 학습할 수 있는 기회였습니다.
많은 지적 부탁드리겠습니다!
(try-with-resources 구문에 대한 중복은 어떻게 제거해야 할지 모르겠네요...)