-
Notifications
You must be signed in to change notification settings - Fork 159
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
Make constructures public to allow creating objects without gson. #390
Conversation
@@ -393,7 +393,7 @@ public String get(String key) { | |||
@SerializedName("transactions") | |||
private final Link transactions; | |||
|
|||
Links(Link effects, Link offers, Link operations, Link self, Link transactions) { | |||
public Links(Link effects, Link offers, Link operations, Link self, Link transactions) { |
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.
@lijamie98 , was just curious what is the use case driving the need to populate the model manually rather than from server api responses?
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.
Here is where I use it
https://github.com/stellar/java-stellar-anchor-dev/pull/7/files#diff-bb19215491831165a984cf8e66a77832f8567401759bba44621d8a21ff46dbceR169
This is an work around. I had to create another class TestSigner to convert to Signer at:
https://github.com/stellar/java-stellar-anchor-dev/pull/7/files#diff-bb19215491831165a984cf8e66a77832f8567401759bba44621d8a21ff46dbceR42
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.
It is actually the Signer class that the tests need a public constructor. However, similar pattern may occur when we do tests in the future.
Builder pattern would work too if public constructors are not preferred. Changing to Builder pattern will also need to change the way we construct AccountResponse.
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, it's for testing concerns. I noticed a few other response POJO's here in the SDK already had public constructors on their inner classes, so, hopefully this is contained to AccountResponse. I wanted to also mention, Spring's ReflectionTestUtils
, as an optional brute force way for tests to access private members of classes under test. I didn't see Spring in the anchor project's pom.xml, but maybe could use that with test scope if this issue of access crops up more.
Yes, It might be nice to for us to consider adding Lombok here into the SDK on these POJOs, and bring in builders. I see you have that in the anchor project as well, nice!
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.
One of the anchor dev project requirements is NOT to use Spring :-(. So, I used gson to bruteforce it. However, I think this can be better solved with either a builder or public constructor.
Lombok is a real nice way to reduce the verboseness of Java. :-) +1
I will change the CHANGELOG on Monday and update the PR.
@lijamie98 , would you mind adding a line here in CHANGELOG to note modification? since it's client facing, thanks! |
Will do
…On Fri, Dec 17, 2021 at 10:09 AM shawn ***@***.***> wrote:
@lijamie98 <https://github.com/lijamie98> , would you mind adding a line
here in CHANGELOG
<https://github.com/stellar/java-stellar-sdk/blob/master/CHANGELOG.md?plain=1#L10>
to note modification? since it's client facing, thanks!
—
Reply to this email directly, view it on GitHub
<#390 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABVTUVCIWDBOOY5R7TVZVBLURN4EFANCNFSM5KJLYBRQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
CHANGELOG.md is also updated. |
@lijamie98 , looks like the commit from your github acct doesn't have gpg signature enabled, the PR can't metge non signed commits in this repo, can you redo commit after gpg enabled? Or lmk, i can assist. |
Thanks for offering the assitance! The commit was signed but the email that I used to sign the PR was mismatching. Fixed the user.email config in my git. It is now work. |
No description provided.