-
Notifications
You must be signed in to change notification settings - Fork 45
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
REFACTOR: Reformat OperationStatus initialization in OperationImpl #766
REFACTOR: Reformat OperationStatus initialization in OperationImpl #766
Conversation
@@ -95,7 +95,7 @@ public void handleLine(String line) { | |||
/* ENABLE_MIGRATION end */ | |||
try { | |||
// <result value>\r\n | |||
Long.valueOf(line); | |||
Long.parseLong(line); |
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.
μ λΌμΈμ΄ νμν μ΄μ κ° λ¬΄μμΈκ°μ?
MutatorOperationImpl μμ LongμΌλ‘ λ³νν΄λκ³ κ°μ μ¬μ©νμ§ μλ κ³³μ΄ μλλ° μ κ±°ν΄λ λμ§ μμκΉμ?
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.
CollectionMutateOperationImpl, MutatorOperationImplμ κ²½μ°, μλ΅κ°μ΄ <result value>\r\n
μΈ κ²½μ°μΌλλ₯Ό μ²λ¦¬ν©λλ€.
result valueλ ν¬κ² 2κ°μ§λ‘ λλ μ μμ΅λλ€.
- μ μ
- μ΄λ μ±κ³΅ν κ²½μ°λ‘, mutate μ°μ°(incr, decr)μ μ±κ³΅νλ€λ μλ―Έμ λλ€.
NOT_FOUND
μ κ°μ μλ΅- μ΄λ μ€ν¨ν κ²½μ°λ‘, keyκ° μλ λ± mutate μ°μ°(incr, decr)μ μ²λ¦¬νμ§ λͺ»νλ€λ μλ―Έμ λλ€.
μλ΅μ΄ μ μκ° μλ μλ¬ λ©μΈμ§μΈ κ²½μ°λ μμΌλ―λ‘, μ μμΈμ§ νμΈνλ λ‘μ§μ νμνλ€κ³ μκ°ν©λλ€.
κΈ°μ‘΄ μ½λμμλ longμΌλ‘ λ³νν κ°μ μ¬μ©νλ λͺ©μ 보λ€λ, μλ΅μ΄ μ μμΈμ§ μλμ§λ‘ ꡬλΆνλ λͺ©μ μ΄ λ ν° κ² κ°μ΅λλ€.
λ§μ½ try-catch λ¬Έμ μ κ±°νλ€λ©΄ μλμ κ°μ ννλ‘ λ³κ²½ν μ μμ΅λλ€.
boolean allDigit = line.chars().allMatch(Character::isDigit); // λλ for loop
if (allDigit) {
getCallback().receivedStatus(new OperationStatus(true, line));
} else {
OperationStatus status = matchStatus(line, NOT_FOUND, ...);
getLogger().debug(status);
getCallback().receivedStatus(status);
}
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.
try-catchλ¬Έμ μ κ±°ν ννλ‘ λ¦¬ν©ν λ§νλ©΄ λ κ² κ°μ΅λλ€.
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.
Long.parseLong()
μ μ¬μ©ν try-catch λ¬Έ λμ , μλ΅μ΄ μ μμΈμ§ νμΈνλ if-elseλ‘ μμ νμ΅λλ€.
CollectionMutateOperationImpl, MutatorOperationImpl ν΄λμ€μμλ§ μλ΅μ try-catchλ‘ λΆκΈ° μ²λ¦¬νλ κ²μΌλ‘ νμΈνμ΅λλ€.
bacec82
to
383fdf0
Compare
|
||
// <result value>\r\n | ||
boolean allDigit = line.chars().allMatch(Character::isDigit); | ||
if (allDigit) { | ||
getCallback().receivedStatus(new OperationStatus(true, line)); |
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.
λ€λ₯Έ λΆλΆκ³Ό μΌκ΄μ± μλλ‘ ifλ¬Έ λ°μμ OperationStatusλ₯Ό μ μΈνκ³ getCallback().receivedStatus(status)
νΈμΆνλ©΄ λ κ² κ°μ΅λλ€.
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.
μμ νμ΅λλ€.
383fdf0
to
f45bae3
Compare
f45bae3
to
a82cfc6
Compare
@uhm0311 μ΅μ’ 리뷰 λ°λλλ€. |
π Related Issue
β¨οΈ What I did
if-else λ¬Έ λ§μ§λ§μμ
transitionState(OperationState.COMPLETE);
λ₯Ό νλ²λ§ νΈμΆνλλ‘ μμ ν©λλ€.CollectionCountOperationImpl
CollectionExistOperationImpl
ν΄λμ€μhandleLine()
λ©μλμμ,matchStatus()
λ©μλλ₯Ό νΈμΆν λNOT_FOUND
μΈμκ° λ λ² μ¬μ©λλ λΆλΆμ ν λ²λ§ μ¬μ©νλλ‘ μμ ν©λλ€.matchStatus()
λ©μλλ₯Ό νΈμΆν λ, μΈμκ° λ§μ μ¬λ¬ μ€λ‘ μμ±λ κ²½μ°OperationStatus
κ°μ²΄λ₯Ό μμ±νλλ‘ ν©λλ€.AS-IS
TO-BE