Enhance: Object -> JSONObject 변환 기능 추가#29
Merged
chamchi00800 merged 1 commit intoinnohack2021:devfrom Nov 27, 2021
greenaloud:dev
Merged
Enhance: Object -> JSONObject 변환 기능 추가#29chamchi00800 merged 1 commit intoinnohack2021:devfrom greenaloud:dev
chamchi00800 merged 1 commit intoinnohack2021:devfrom
greenaloud:dev
Conversation
Object 에서 JSONObject 로 변환하는 함수 추가
Jack-R-lantern
approved these changes
Nov 27, 2021
Contributor
Jack-R-lantern
left a comment
There was a problem hiding this comment.
멘토님이 제시한 방향이 기본적인것 부터 구현하라는 요구를 잘 구현한것을 확인했습니다.
감사합니다.
Comment on lines
+23
to
+52
| if(value instanceof String){ | ||
| map.put(key, value.toString()); | ||
| continue; | ||
| } | ||
|
|
||
| if(value instanceof Double){ | ||
| if(((Double)value).isInfinite() || ((Double)value).isNaN()) | ||
| map.put(key, "null"); | ||
| else | ||
| map.put(key, value); | ||
| continue; | ||
| } | ||
|
|
||
| if(value instanceof Float){ | ||
| if(((Float)value).isInfinite() || ((Float)value).isNaN()) | ||
| map.put(key, "null"); | ||
| else | ||
| map.put(key, value); | ||
| continue; | ||
| } | ||
|
|
||
| if(value instanceof Number){ | ||
| map.put(key, value); | ||
| continue; | ||
| } | ||
|
|
||
| if(value instanceof Boolean){ | ||
| map.put(key, value); | ||
| continue; | ||
| } |
Contributor
There was a problem hiding this comment.
primitive 타입을 찾는 로직을 확인했습니다.
내부적으로 논의한 JSON의 값이 숫자일때 명확히 어떻게 동작하는지만 확인하면 될것 같습니다.
Comment on lines
+56
to
+59
| if(value instanceof Object){ | ||
| JSONObject newMap = toJson(value); | ||
| map.put(key, newMap); | ||
| } |
Contributor
There was a problem hiding this comment.
JSON의 value의 object가 다양한 wrapper를 포함할때 로직을 어떻게 구현해야할지는
다같이 좀 더 고민해봐야할것 같습니다.
|
primitive 타입일 때 받는 테스트 잘 확인했습니다. |
247programmers
added a commit
to 247programmers/HotSource
that referenced
this pull request
Nov 27, 2021
* Add JSON에서 엔티티 변환 * feat: add new feature (innohack2021#29) Object 에서 JSONObject 로 변환하는 함수 추가 * Env: GithubAction 변경 *environment: main브렌치에서 이벤트를 감지하게 변경 * docs : GUIDELINE 폴더 수정 (innohack2021#30) docs : GUIDELINE폴더 내용 파일 가독성 향상을 위한 파일 수정
| for (Field field : fields) { | ||
| field.setAccessible(true); | ||
| String key = field.getName(); | ||
| // Object 인 경우 || String, Wrapper Type 인 경우 || Array 인 경우??? 여튼 조건이 필요하다 |
chamchi00800
pushed a commit
that referenced
this pull request
Nov 27, 2021
* Add JSON에서 엔티티 변환 * Add JSON에서 엔티티 변환 * feat: add new feature (#29) Object 에서 JSONObject 로 변환하는 함수 추가 * Add JSONObject 오브젝트 타입 받기 * Add JSONObject 오브젝트 타입 받기 * Add JSONObject 오브젝트 타입 받기 * Env: GithubAction 변경 *environment: main브렌치에서 이벤트를 감지하게 변경 * docs : GUIDELINE 폴더 수정 (#30) docs : GUIDELINE폴더 내용 파일 가독성 향상을 위한 파일 수정 * Add 오브젝트 변환 초기기능 구현 완료 * Fix build.yml Syntax 수정 * 가이드라인 삭제 Co-authored-by: 조원우 <64305493+greenaloud@users.noreply.github.com> Co-authored-by: Jack-R-lantern <tjdfkr2421@gmail.com> Co-authored-by: 247programmers <79981382+247programmers@users.noreply.github.com>
chamchi00800
pushed a commit
that referenced
this pull request
Nov 27, 2021
* Add JSON에서 엔티티 변환 * Add JSON에서 엔티티 변환 * feat: add new feature (#29) Object 에서 JSONObject 로 변환하는 함수 추가 * Add JSONObject 오브젝트 타입 받기 * Add JSONObject 오브젝트 타입 받기 * Add JSONObject 오브젝트 타입 받기 * Env: GithubAction 변경 *environment: main브렌치에서 이벤트를 감지하게 변경 * docs : GUIDELINE 폴더 수정 (#30) docs : GUIDELINE폴더 내용 파일 가독성 향상을 위한 파일 수정 * Add 오브젝트 변환 초기기능 구현 완료 * Fix build.yml Syntax 수정 * 가이드라인 삭제 * Fix ListType 초기화 실패 * Rename Build.yml -> SonarCloud.yml * Fix ListType 초기화 실패 #35 Co-authored-by: 조원우 <64305493+greenaloud@users.noreply.github.com> Co-authored-by: Jack-R-lantern <tjdfkr2421@gmail.com> Co-authored-by: 247programmers <79981382+247programmers@users.noreply.github.com>
chamchi00800
pushed a commit
that referenced
this pull request
Nov 28, 2021
* Add JSON에서 엔티티 변환 * Add JSON에서 엔티티 변환 * feat: add new feature (#29) Object 에서 JSONObject 로 변환하는 함수 추가 * Add JSONObject 오브젝트 타입 받기 * Add JSONObject 오브젝트 타입 받기 * Add JSONObject 오브젝트 타입 받기 * Env: GithubAction 변경 *environment: main브렌치에서 이벤트를 감지하게 변경 * docs : GUIDELINE 폴더 수정 (#30) docs : GUIDELINE폴더 내용 파일 가독성 향상을 위한 파일 수정 * Add 오브젝트 변환 초기기능 구현 완료 * Fix build.yml Syntax 수정 * 가이드라인 삭제 * Fix ListType 초기화 실패 * Rename Build.yml -> SonarCloud.yml * Fix ListType 초기화 실패 #35 * Delete Exception * Refactor 전체적인 코드취약점 * Refactor 전체적인 코드취약점 #37 Co-authored-by: 조원우 <64305493+greenaloud@users.noreply.github.com> Co-authored-by: Jack-R-lantern <tjdfkr2421@gmail.com> Co-authored-by: 247programmers <79981382+247programmers@users.noreply.github.com>
chamchi00800
pushed a commit
that referenced
this pull request
Nov 28, 2021
* Add JSON에서 엔티티 변환 * Add JSON에서 엔티티 변환 * feat: add new feature (#29) Object 에서 JSONObject 로 변환하는 함수 추가 * Add JSONObject 오브젝트 타입 받기 * Add JSONObject 오브젝트 타입 받기 * Add JSONObject 오브젝트 타입 받기 * Env: GithubAction 변경 *environment: main브렌치에서 이벤트를 감지하게 변경 * Env: GithubAction 변경 *environment: SonarCloud main브렌치에서만 동작하게 변경 * docs : GUIDELINE 폴더 수정 (#30) docs : GUIDELINE폴더 내용 파일 가독성 향상을 위한 파일 수정 * Add 오브젝트 변환 초기기능 구현 완료 * Fix build.yml Syntax 수정 * 가이드라인 삭제 * Fix ListType 초기화 실패 * Rename Build.yml -> SonarCloud.yml * Fix ListType 초기화 실패 #35 * Delete Exception * Refactor 전체적인 코드취약점 * Refactor 전체적인 코드취약점 #37 * FileToObject * retry, rm FileToObject, rm ObjectToFile.getpwd() * Fix get ListType 받을 수 없던 문제 * plz22 * merge * Fix test * Refactor 코드 수정 * Refactor 코드 수정 Co-authored-by: 조원우 <64305493+greenaloud@users.noreply.github.com> Co-authored-by: Jack-R-lantern <tjdfkr2421@gmail.com> Co-authored-by: 247programmers <79981382+247programmers@users.noreply.github.com> Co-authored-by: FeFe2200 <67796301+FeFe2200@users.noreply.github.com> Co-authored-by: fefe2200 <dlcjf2200@naver.com>
chamchi00800
pushed a commit
that referenced
this pull request
Nov 28, 2021
* Add JSON에서 엔티티 변환 * Add JSON에서 엔티티 변환 * feat: add new feature (#29) Object 에서 JSONObject 로 변환하는 함수 추가 * Add JSONObject 오브젝트 타입 받기 * Add JSONObject 오브젝트 타입 받기 * Add JSONObject 오브젝트 타입 받기 * Env: GithubAction 변경 *environment: main브렌치에서 이벤트를 감지하게 변경 * Env: GithubAction 변경 *environment: SonarCloud main브렌치에서만 동작하게 변경 * docs : GUIDELINE 폴더 수정 (#30) docs : GUIDELINE폴더 내용 파일 가독성 향상을 위한 파일 수정 * Add 오브젝트 변환 초기기능 구현 완료 * Fix build.yml Syntax 수정 * 가이드라인 삭제 * Fix ListType 초기화 실패 * Rename Build.yml -> SonarCloud.yml * Fix ListType 초기화 실패 #35 * Delete Exception * Refactor 전체적인 코드취약점 * Refactor 전체적인 코드취약점 #37 * FileToObject * retry, rm FileToObject, rm ObjectToFile.getpwd() * Fix get ListType 받을 수 없던 문제 * plz22 * fin. Co-authored-by: SIOUkoeran <alstnalsgud@gmail.com> Co-authored-by: 조원우 <64305493+greenaloud@users.noreply.github.com> Co-authored-by: Jack-R-lantern <tjdfkr2421@gmail.com> Co-authored-by: 247programmers <79981382+247programmers@users.noreply.github.com>
chamchi00800
pushed a commit
that referenced
this pull request
Nov 29, 2021
* Add JSON에서 엔티티 변환 * Add JSON에서 엔티티 변환 * feat: add new feature (#29) Object 에서 JSONObject 로 변환하는 함수 추가 * Add JSONObject 오브젝트 타입 받기 * Add JSONObject 오브젝트 타입 받기 * Add JSONObject 오브젝트 타입 받기 * Env: GithubAction 변경 *environment: main브렌치에서 이벤트를 감지하게 변경 * Env: GithubAction 변경 *environment: SonarCloud main브렌치에서만 동작하게 변경 * docs : GUIDELINE 폴더 수정 (#30) docs : GUIDELINE폴더 내용 파일 가독성 향상을 위한 파일 수정 * Add 오브젝트 변환 초기기능 구현 완료 * Fix build.yml Syntax 수정 * 가이드라인 삭제 * Fix ListType 초기화 실패 * Rename Build.yml -> SonarCloud.yml * Fix ListType 초기화 실패 #35 * Delete Exception * Refactor 전체적인 코드취약점 * Refactor 전체적인 코드취약점 #37 * FileToObject * retry, rm FileToObject, rm ObjectToFile.getpwd() * Fix get ListType 받을 수 없던 문제 * plz22 * merge * Fix test * Refactor 코드 수정 * Refactor 코드 수정 * merge * Add javaDoc Co-authored-by: 조원우 <64305493+greenaloud@users.noreply.github.com> Co-authored-by: Jack-R-lantern <tjdfkr2421@gmail.com> Co-authored-by: 247programmers <79981382+247programmers@users.noreply.github.com> Co-authored-by: FeFe2200 <67796301+FeFe2200@users.noreply.github.com> Co-authored-by: fefe2200 <dlcjf2200@naver.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Object -> JSONObject 변환 기능 추가
종류
내용
ObjectToJson.java 파일 추가
핵심 기능인 Object -> JSONObject 변환 기능 추가
현재 단일 ReferenceObject, String, 기본타입 Wrapper 클래스인 경우에만 정상동작
연관된 이슈
close #28