-
Notifications
You must be signed in to change notification settings - Fork 724
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
Enable injection of GitHub and other values into mapping #720
Conversation
@@ -43,7 +57,7 @@ | |||
* the io exception | |||
*/ | |||
public GHUser getOwner() throws IOException { | |||
return root.intern(owner); | |||
return owner; |
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.
owner is alway interned during construction now.
GHGist wrapUp(GHUser owner) { | ||
this.owner = owner; | ||
this.root = owner.root; | ||
wrapUp(); | ||
return this; | ||
} | ||
|
||
/** | ||
* Used when caller obtains {@link GHGist} without knowing its owner. A partially constructed owner object is | ||
* interned. | ||
*/ | ||
GHGist wrapUp(GitHub root) { | ||
this.owner = root.getUser(owner); | ||
this.root = root; | ||
wrapUp(); | ||
return this; | ||
} | ||
|
||
private void wrapUp() { | ||
for (Entry<String, GHGistFile> e : files.entrySet()) { | ||
e.getValue().fileName = e.getKey(); | ||
} |
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.
Actions that were being done after instantiation are now done in the constructor, allowing for those values to be final
.
Description
Progress on #599. While there will alway be a need for late binding in some scenarios, binding of
GitHub
reference can always be done during mapping. Other actions that were being done after mapping can also sometimes be done during mapping by using a constructor. Values not initialized in the constructor are bound via reflection as they always were.Before submitting a PR:
We love getting PRs, but we hate asking people for the same basic changes every time.
master
. Create your PR from that branch.mvn -D enable-ci clean install site
locally. This may reformat your code, commit those changes. If this command doesn't succeed, your change will not pass CI.