-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
FINERACT-2181: Refactor ResultsetColumnHeaderData using Lombok and modern java new features #4307
base: develop
Are you sure you want to change the base?
Conversation
return ResultsetColumnHeaderData.builder() | ||
.columnName(columnName) | ||
.columnType(JdbcJavaType.getByTypeName(dialect, adjustColumnType(columnType), true)) | ||
.columnLength(null) |
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.
why set null? we could omit this in the builder rather than set null
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.
Same goes for primitive boolean types. It is nice to explicitly set, but in the other hand it is unnecessary
@@ -6,9 +6,9 @@ | |||
* to you under the Apache License, Version 2.0 (the | |||
* "License"); you may not use this file except in compliance | |||
* with the License. You may obtain a copy of the License at | |||
* | |||
* <p> |
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.
Please do not change the licence header
} | ||
if (columnType.isTextType()) return DisplayType.TEXT; | ||
if (columnType.isStringType()) return DisplayType.STRING; | ||
if (columnType.isAnyIntegerType()) return DisplayType.INTEGER; |
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.
a switch or a map will be better in this case
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.
@oluexpert99
Thanks for your response .. i noted your comments then refactored the code according to yours and waiting for feedback
return columnValues != null && !columnValues.isEmpty(); | ||
} | ||
|
||
public boolean isColumnValueAllowed(final String match) { |
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 is used in the SeachUtil class... i am not sure why you removed it....
return false; | ||
} | ||
|
||
public boolean isColumnCodeAllowed(final Integer match) { |
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.
Same here...
return this.columnName; | ||
} | ||
|
||
public boolean isNamed(final String columnName) { |
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 methid is used in many classes.
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.
@a7med3del1973 could you please review the comment?
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.
Kindly review the comments!
@adamsaghy |
@a7med3del1973 please squash your commits! |
1 similar comment
@a7med3del1973 please squash your commits! |
b68b45b
to
e384bfa
Compare
@adamsaghy squash done |
2b77e08
to
41b4859
Compare
@adamsaghy |
public final class ResultsetColumnHeaderData implements Serializable { | ||
|
||
private final String columnName; | ||
private JdbcJavaType columnType; | ||
private final Long columnLength; | ||
private final DisplayType columnDisplayType; | ||
@Getter(AccessLevel.NONE) |
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.
We dont need to restricted getter for these fields...
return null; | ||
Map<Predicate<JdbcJavaType>, DisplayType> typeMap = new LinkedHashMap<>(); | ||
|
||
typeMap.put(JdbcJavaType::isTextType, DisplayType.TEXT); |
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.
Using switch-case would be better...
41b4859
to
c78a15c
Compare
@a7med3del1973 what's the purpose here? are you familiar with Java and have an IDE set up properly? I really feel like you're just starting out hence the "used in SearchUtil" comments in the codebase. Also, the PR builds are failing, probably due to formatting issues (haven't checked). |
@galovics Thanks for your review |
c78a15c
to
616da39
Compare
@a7med3del1973 Kindly fix the failing checks:
|
616da39
to
d529545
Compare
@a7med3del1973 Please make sure the PR title and commit message are following the required naming conventions: "FINERACT-XXXX: short description" |
d529545
to
0646edd
Compare
@a7med3del1973 FINERACT-2081 was a story to cover minor changes in 1.11. Since this version of release process started, we cannot use this story anymore. Kindly use the https://issues.apache.org/jira/browse/FINERACT-2181 from now on for minor changes which will be part of 1.12. |
0646edd
to
5995e49
Compare
Changes done. |
5995e49
to
9813a07
Compare
@@ -239,40 +206,58 @@ private DisplayType calcDisplayType() { | |||
} | |||
|
|||
public static DisplayType calcColumnDisplayType(JdbcJavaType columnType) { | |||
return switch (getJdbcType(columnType)) { |
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.
I see no any value of this changes....
If you want to change the IF conditions to switch fine... but why to map JdbcJavaType to String and from String to DisplayType?
Map JdbcJavaType to DisplayType with mapper if you want...
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.
I see no any value of this changes.... If you want to change the IF conditions to switch fine... but why to map JdbcJavaType to String and from String to DisplayType?
Map JdbcJavaType to DisplayType with mapper if you want...
Got it your opinion
Thinked my change will make it easy for add new property
above i already used mapper you told me switch case will be better.
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.
See my review...
…n Java new features
9813a07
to
609b152
Compare
Description
Ignore if these details are present on the associated Apache Fineract JIRA ticket.
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Write the commit message as per https://github.com/apache/fineract/#pull-requests
Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
Create/update unit or integration tests for verifying the changes made.
Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.
Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
Submission is not a "code dump". (Large changes can be made "in repository" via a branch. Ask on the developer mailing list for guidance, if required.)
FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.