You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
β λ¬Έμ μν©
No response
π ν΅μ¬ λ΄μ©κ³Ό λ°©ν₯μ±
π CommonUtil ν΄λμ€ λ¬Έμ
CommonUtilν΄λμ€λ 곡ν΅μ μΌλ‘ μ¬μ©ν μ νΈλ¦¬ν° λ©μλλ₯Ό μ 곡νλ ν΄λμ€μ λλ€.λ¬Έμμ΄ λ° μ μ λ³ν, μν°ν°λ₯Ό DTOλ‘ λ³ννλ κΈ°λ₯μ ν¬ν¨νκ³ μμ΅λλ€.
π 1. nvl λ©μλ
μ€λͺ
nullμ²λ¦¬:str1μ΄nullμ΄λ©΄str2λ₯Ό λ°νν©λλ€."null"μ²λ¦¬:str1μ΄"null"λ¬Έμμ΄μ΄λ©΄str2λ₯Ό λ°νν©λλ€."") λλ 곡백 λ¬Έμμ΄(" ") μ²λ¦¬:str1μ΄ κ³΅λ°±λ§ ν¬ν¨νλ κ²½μ°str2λ₯Ό λ°νν©λλ€.λ©μλ μκ·Έλμ²
λ§€κ°λ³μ
str1Stringstr2Stringstr1μ΄nullλλ"null"λλ λΉ λ¬Έμμ΄μΌ κ²½μ° λ°νν λ¬Έμμ΄λ°ν κ°
str1μ΄null,"null", λΉ λ¬Έμμ΄μ΄λ©΄str2λ°νstr1λ°νμμ
π 2. null2ZeroInt λ©μλ
μ€λͺ
nullκ° μ²λ¦¬:Integerκ°μ΄nullμ΄λ©΄0μ λ°νν©λλ€.λ©μλ μκ·Έλμ²
λ§€κ°λ³μ
valIntegerIntegerκ°λ°ν κ°
valμ΄nullμ΄λ©΄0λ°νvalκ·Έλλ‘ λ°νμμ
π 3. convertEntityToDto λ©μλ
μ€λͺ
BeanUtils.copyProperties()λ₯Ό μ¬μ©νμ¬ νλ κ°μ 볡μ¬ν©λλ€.entityκ°nullμ΄λ©΄nullμ λ°νν©λλ€.λ©μλ μκ·Έλμ²
λ§€κ°λ³μ
entityEdtoClassClass<D>λ°ν κ°
entityκ°nullμ΄λ©΄nullλ°νμμ
π μμΈ μ²λ¦¬
convertEntityToDto()μ€ν μ€ μ€λ₯κ° λ°μνλ©΄ λ°νμ μμΈ(RuntimeException)κ° λ°μν©λλ€.log.error(...))κ° κΈ°λ‘λ©λλ€.π κ²°λ‘
nvl(str1, str2)null,"null", λΉ λ¬Έμμ΄("")μstr2λ‘ λ체null2ZeroInt(val)nullμ΄λ©΄0λ°νconvertEntityToDto(entity, dtoClass)μ΄
CommonUtilν΄λμ€λ λ¬Έμμ΄ λ³ν, μ μ λ³ν, DTO λ³ν κΈ°λ₯μ μ 곡νμ¬ μ½λμ μΌκ΄μ±μ μ μ§νκ³ μ¬μ¬μ©μ±μ λμ΄λ λ° λμμ μ€λλ€. ππ₯π νΈλ¬λΈμν λ° κΈ°λν¨κ³Ό
No response
π κ΄λ ¨ μλ£
No response
πβ λ΄λΉμ
Beta Was this translation helpful? Give feedback.
All reactions