Skip to content
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

Merged
merged 3 commits into from
Feb 28, 2020

Conversation

bitwiseman
Copy link
Member

@bitwiseman bitwiseman commented Feb 27, 2020

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.

  • Push your changes to a branch other than master. Create your PR from that branch.
  • Add JavaDocs and other comments
  • Write tests that run and pass in CI. See CONTRIBUTING.md for details on how to capture snapshot data.
  • Run 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.

@@ -43,7 +57,7 @@
* the io exception
*/
public GHUser getOwner() throws IOException {
return root.intern(owner);
return owner;
Copy link
Member Author

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.

Comment on lines -145 to -166
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();
}
Copy link
Member Author

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.

@bitwiseman bitwiseman merged commit c11c06b into hub4j:master Feb 28, 2020
@bitwiseman bitwiseman deleted the task/inject-root branch February 28, 2020 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant