-
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
Refactor ResultsetColumnHeaderData to Use Lombok Annotations for Boilerplate Reduction #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.
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:
|
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.