-
Notifications
You must be signed in to change notification settings - Fork 273
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
chore:2733 design level refactoring #2736
chore:2733 design level refactoring #2736
Conversation
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.
Is this the same refactor as #2734?
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.
yes, to avoid confusion I have created a new separate PR which covers 2 additional commits for refactor. will discard this PR.
New ref PR: #2738
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.
Is this the same refactor as #2734 ?
@Override | ||
public int hashCode() { | ||
int h = hash; | ||
if (h == 0) { | ||
h = internalHashCode(); | ||
hash = h; | ||
} | ||
return h; | ||
} | ||
|
||
protected int internalHashCode() { | ||
final int prime = 31; | ||
int result = 1; | ||
result = | ||
prime * result | ||
+ ((this.getPortletWindowId() == null) | ||
? 0 | ||
: this.getPortletWindowId().hashCode()); | ||
result = | ||
prime * result | ||
+ ((this.getEventType() == null) ? 0 : this.getEventType().hashCode()); | ||
return result; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.getClass().getSimpleName() | ||
+ " [" | ||
+ "portletWindowId=" | ||
+ this.getPortletWindowId() | ||
+ "]"; |
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.
Would it make sense to leverage lombok for these?
https://projectlombok.org/features/EqualsAndHashCode
https://projectlombok.org/features/ToString
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.
Thanks @ChristianMurphy for sharing the link.
My primary goal was to find code duplicates like this and refactor them.
Since this code was duplicated in 5/6 classes, I have pulled up this method and variable to promote code re-use.
Meanwhile, If my refactor change is fine, May I request it to be merged ?
I will explore this and update this part in a separate PR subsequently.
ref PR: #2738
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.
is this the same as #2734 ?
Checklist