StringHelper.createFormPartName() 및 test가 추가되었습니다.
메일
Added StringHelper.createFormPartName and tests
Phil Adams
Summary
The new StringHelper.createFormPartName() function introduced by this PR will be used by generated java code when the "mapified form parameter" feature is used.
Phil Adams
Summary
The new StringHelper.createFormPartName() function introduced by this PR will be used by generated java code when the "mapified form parameter" feature is used.
You can view, comment on, or merge this pull request online at:
Commit Summary
- Added StringHelper.
createFormPartName and tests
File Changes
Patch Links:
Mike Kistler
@mkistler requested changes on this pull request.
@mkistler requested changes on this pull request.
I think we can avoid adding this code to the SDK with some small changes to the generator.
> + * Creates a parameterized part name for a form part based on a template and a key name and value. + * Example: + * template: "{classname}_positive_examples" + * keyName: "classname" + * keyValue: "truck" + * result: "truck_positive_examples" + * + * @param template the part name template + * @param keyName the name of the key within the template + * @param keyValue the value of the key to use as a replacement + * @return + */ + public static String createFormPartName(String template, String keyName, String keyValue) { + String toBeReplaced = "{" + keyName + "}"; + return template.replace(toBeReplaced, keyValue); + }
It seems like we could avoid having this special function if we did just a little more work in the generator.In particular, I think we could, in the generator, create a "format string" from the template:"{classname}_positive_
examples" -> "%s_positive_examples" Then in the service method, we changeString partName = StringHelper.
createFormPartName("{{ partNameTemplate}}", "{{mapKeyName}}", entry.getKey()); toString partName = String.format("{{
partNameFormatString}}", entry.getKey());
Codecov
Codecov Report
Merging #994 into master will decrease coverage by <.01%.
The diff coverage is 100%.
....
Codecov Report
Merging #994 into master will decrease coverage by <.01%.
The diff coverage is 100%.
....
Phil Adams
This PR will not be needed afterall...
This PR will not be needed afterall...
번역
StringHelper.createFormPartName 및 tests가 추가되었습니다.
Phil Adams
개요
이 PR로 도입된 새로운 StringHelper.createFormPartName() 함수는 "mapified form parameter" 기능이 사용될 때 생성된 java code에 의해 사용됩니다.
Phil Adams
개요
이 PR로 도입된 새로운 StringHelper.createFormPartName() 함수는 "mapified form parameter" 기능이 사용될 때 생성된 java code에 의해 사용됩니다.
Mike Kistler
@mkistler pull 요청에 대한 변경을 요청했습니다.
@mkistler pull 요청에 대한 변경을 요청했습니다.
생성자에 조금 변경을 가하면 이 코드를 SDK에 추가하는 것을 피할 수 있을 겁니다.
> + * Creates a parameterized part name for a form part based on a template and a key name and value. + * Example: + * template: "{classname}_positive_examples" + * keyName: "classname" + * keyValue: "truck" + * result: "truck_positive_examples" + * + * @param template the part name template + * @param keyName the name of the key within the template + * @param keyValue the value of the key to use as a replacement + * @return + */ + public static String createFormPartName(String template, String keyName, String keyValue) { + String toBeReplaced = "{" + keyName + "}"; + return template.replace(toBeReplaced, keyValue); + }
생성자에 좀 더 많은 작업을 했다면, 이 특수 function을 사용하지 않아도 될 것 같습니다.특히 생성자에서 템플릿으로부터 "형식 string"을 만들 수 있다고 생각합니다."{classname}_positive_
examples" -> "%s_positive_examples" 그런 다음 서비스 method에서String partName = StringHelper.
createFormPartName("{{ partNameTemplate}}", "{{mapKeyName}}", entry.getKey()); 를String partName = String.format("{{
partNameFormatString}}", entry.getKey());
로 변경합니다.
Codecov
Codecov Report
#994를 master에 merge하면 적용범휘가 <.01 % 감소합니다.
변경된 적용범위는 100%입니다.
....
Codecov Report
#994를 master에 merge하면 적용범휘가 <.01 % 감소합니다.
변경된 적용범위는 100%입니다.
....
Phil Adams
결국 이 PR은 필요없을 것입니다...
결국 이 PR은 필요없을 것입니다...
댓글 없음:
댓글 쓰기