Skip to content

Commit

Permalink
Regenerate XDR types using latest version of xdrgen (#314)
Browse files Browse the repository at this point in the history
The XDR classes have been regenerated using the latest version of xdrgen which provides the following two features:

stellar/xdrgen#56 Builder static inner classes to unions and structs
stellar/xdrgen#57 Constructors for typedefs
  • Loading branch information
tamirms authored Jan 9, 2021
1 parent e12ba3d commit 6d156bd
Show file tree
Hide file tree
Showing 149 changed files with 5,782 additions and 308 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

As this project is pre 1.0, breaking changes may happen for minor version bumps. A breaking change will get clearly notified in this log.

## 0.22.0
- The XDR classes have been regenerated using the latest version of xdrgen which provides the following two features:

- Builder static inner classes to unions and structs
- Constructors for typedefs

## 0.21.2
- Update challenge transaction helpers for SEP-0010 v3.0.0. ([#308](https://github.com/stellar/java-stellar-sdk/pull/308))
- Fix the decoding of `balanceId` in `org.stellar.sdk.ClaimClaimableBalanceOperation`. ([#310](https://github.com/stellar/java-stellar-sdk/pull/310))
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ apply plugin: 'com.github.ben-manes.versions' // gradle dependencyUpdates -Drevi
apply plugin: 'project-report' // gradle htmlDependencyReport

sourceCompatibility = 1.6
version = '0.21.2'
version = '0.22.0'
group = 'stellar'

jar {
Expand Down
105 changes: 103 additions & 2 deletions src/main/java/org/stellar/sdk/xdr/AccountEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,92 @@ public int hashCode() {
}
@Override
public boolean equals(Object object) {
if (object == null || !(object instanceof AccountEntry)) {
if (!(object instanceof AccountEntry)) {
return false;
}

AccountEntry other = (AccountEntry) object;
return Objects.equal(this.accountID, other.accountID) && Objects.equal(this.balance, other.balance) && Objects.equal(this.seqNum, other.seqNum) && Objects.equal(this.numSubEntries, other.numSubEntries) && Objects.equal(this.inflationDest, other.inflationDest) && Objects.equal(this.flags, other.flags) && Objects.equal(this.homeDomain, other.homeDomain) && Objects.equal(this.thresholds, other.thresholds) && Arrays.equals(this.signers, other.signers) && Objects.equal(this.ext, other.ext);
}

public static final class Builder {
private AccountID accountID;
private Int64 balance;
private SequenceNumber seqNum;
private Uint32 numSubEntries;
private AccountID inflationDest;
private Uint32 flags;
private String32 homeDomain;
private Thresholds thresholds;
private Signer[] signers;
private AccountEntryExt ext;

public Builder accountID(AccountID accountID) {
this.accountID = accountID;
return this;
}

public Builder balance(Int64 balance) {
this.balance = balance;
return this;
}

public Builder seqNum(SequenceNumber seqNum) {
this.seqNum = seqNum;
return this;
}

public Builder numSubEntries(Uint32 numSubEntries) {
this.numSubEntries = numSubEntries;
return this;
}

public Builder inflationDest(AccountID inflationDest) {
this.inflationDest = inflationDest;
return this;
}

public Builder flags(Uint32 flags) {
this.flags = flags;
return this;
}

public Builder homeDomain(String32 homeDomain) {
this.homeDomain = homeDomain;
return this;
}

public Builder thresholds(Thresholds thresholds) {
this.thresholds = thresholds;
return this;
}

public Builder signers(Signer[] signers) {
this.signers = signers;
return this;
}

public Builder ext(AccountEntryExt ext) {
this.ext = ext;
return this;
}

public AccountEntry build() {
AccountEntry val = new AccountEntry();
val.setAccountID(accountID);
val.setBalance(balance);
val.setSeqNum(seqNum);
val.setNumSubEntries(numSubEntries);
val.setInflationDest(inflationDest);
val.setFlags(flags);
val.setHomeDomain(homeDomain);
val.setThresholds(thresholds);
val.setSigners(signers);
val.setExt(ext);
return val;
}
}

public static class AccountEntryExt {
public AccountEntryExt () {}
Integer v;
Expand All @@ -188,6 +266,29 @@ public AccountEntryExtensionV1 getV1() {
public void setV1(AccountEntryExtensionV1 value) {
this.v1 = value;
}

public static final class Builder {
private Integer discriminant;
private AccountEntryExtensionV1 v1;

public Builder discriminant(Integer discriminant) {
this.discriminant = discriminant;
return this;
}

public Builder v1(AccountEntryExtensionV1 v1) {
this.v1 = v1;
return this;
}

public AccountEntryExt build() {
AccountEntryExt val = new AccountEntryExt();
val.setDiscriminant(discriminant);
val.setV1(v1);
return val;
}
}

public static void encode(XdrDataOutputStream stream, AccountEntryExt encodedAccountEntryExt) throws IOException {
//Xdrgen::AST::Typespecs::Int
//Integer
Expand Down Expand Up @@ -222,7 +323,7 @@ public int hashCode() {
}
@Override
public boolean equals(Object object) {
if (object == null || !(object instanceof AccountEntryExt)) {
if (!(object instanceof AccountEntryExt)) {
return false;
}

Expand Down
49 changes: 47 additions & 2 deletions src/main/java/org/stellar/sdk/xdr/AccountEntryExtensionV1.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,36 @@ public int hashCode() {
}
@Override
public boolean equals(Object object) {
if (object == null || !(object instanceof AccountEntryExtensionV1)) {
if (!(object instanceof AccountEntryExtensionV1)) {
return false;
}

AccountEntryExtensionV1 other = (AccountEntryExtensionV1) object;
return Objects.equal(this.liabilities, other.liabilities) && Objects.equal(this.ext, other.ext);
}

public static final class Builder {
private Liabilities liabilities;
private AccountEntryExtensionV1Ext ext;

public Builder liabilities(Liabilities liabilities) {
this.liabilities = liabilities;
return this;
}

public Builder ext(AccountEntryExtensionV1Ext ext) {
this.ext = ext;
return this;
}

public AccountEntryExtensionV1 build() {
AccountEntryExtensionV1 val = new AccountEntryExtensionV1();
val.setLiabilities(liabilities);
val.setExt(ext);
return val;
}
}

public static class AccountEntryExtensionV1Ext {
public AccountEntryExtensionV1Ext () {}
Integer v;
Expand All @@ -84,6 +106,29 @@ public AccountEntryExtensionV2 getV2() {
public void setV2(AccountEntryExtensionV2 value) {
this.v2 = value;
}

public static final class Builder {
private Integer discriminant;
private AccountEntryExtensionV2 v2;

public Builder discriminant(Integer discriminant) {
this.discriminant = discriminant;
return this;
}

public Builder v2(AccountEntryExtensionV2 v2) {
this.v2 = v2;
return this;
}

public AccountEntryExtensionV1Ext build() {
AccountEntryExtensionV1Ext val = new AccountEntryExtensionV1Ext();
val.setDiscriminant(discriminant);
val.setV2(v2);
return val;
}
}

public static void encode(XdrDataOutputStream stream, AccountEntryExtensionV1Ext encodedAccountEntryExtensionV1Ext) throws IOException {
//Xdrgen::AST::Typespecs::Int
//Integer
Expand Down Expand Up @@ -118,7 +163,7 @@ public int hashCode() {
}
@Override
public boolean equals(Object object) {
if (object == null || !(object instanceof AccountEntryExtensionV1Ext)) {
if (!(object instanceof AccountEntryExtensionV1Ext)) {
return false;
}

Expand Down
56 changes: 54 additions & 2 deletions src/main/java/org/stellar/sdk/xdr/AccountEntryExtensionV2.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,50 @@ public int hashCode() {
}
@Override
public boolean equals(Object object) {
if (object == null || !(object instanceof AccountEntryExtensionV2)) {
if (!(object instanceof AccountEntryExtensionV2)) {
return false;
}

AccountEntryExtensionV2 other = (AccountEntryExtensionV2) object;
return Objects.equal(this.numSponsored, other.numSponsored) && Objects.equal(this.numSponsoring, other.numSponsoring) && Arrays.equals(this.signerSponsoringIDs, other.signerSponsoringIDs) && Objects.equal(this.ext, other.ext);
}

public static final class Builder {
private Uint32 numSponsored;
private Uint32 numSponsoring;
private SponsorshipDescriptor[] signerSponsoringIDs;
private AccountEntryExtensionV2Ext ext;

public Builder numSponsored(Uint32 numSponsored) {
this.numSponsored = numSponsored;
return this;
}

public Builder numSponsoring(Uint32 numSponsoring) {
this.numSponsoring = numSponsoring;
return this;
}

public Builder signerSponsoringIDs(SponsorshipDescriptor[] signerSponsoringIDs) {
this.signerSponsoringIDs = signerSponsoringIDs;
return this;
}

public Builder ext(AccountEntryExtensionV2Ext ext) {
this.ext = ext;
return this;
}

public AccountEntryExtensionV2 build() {
AccountEntryExtensionV2 val = new AccountEntryExtensionV2();
val.setNumSponsored(numSponsored);
val.setNumSponsoring(numSponsoring);
val.setSignerSponsoringIDs(signerSponsoringIDs);
val.setExt(ext);
return val;
}
}

public static class AccountEntryExtensionV2Ext {
public AccountEntryExtensionV2Ext () {}
Integer v;
Expand All @@ -104,6 +140,22 @@ public Integer getDiscriminant() {
public void setDiscriminant(Integer value) {
this.v = value;
}

public static final class Builder {
private Integer discriminant;

public Builder discriminant(Integer discriminant) {
this.discriminant = discriminant;
return this;
}

public AccountEntryExtensionV2Ext build() {
AccountEntryExtensionV2Ext val = new AccountEntryExtensionV2Ext();
val.setDiscriminant(discriminant);
return val;
}
}

public static void encode(XdrDataOutputStream stream, AccountEntryExtensionV2Ext encodedAccountEntryExtensionV2Ext) throws IOException {
//Xdrgen::AST::Typespecs::Int
//Integer
Expand Down Expand Up @@ -132,7 +184,7 @@ public int hashCode() {
}
@Override
public boolean equals(Object object) {
if (object == null || !(object instanceof AccountEntryExtensionV2Ext)) {
if (!(object instanceof AccountEntryExtensionV2Ext)) {
return false;
}

Expand Down
18 changes: 15 additions & 3 deletions src/main/java/org/stellar/sdk/xdr/AccountID.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,42 @@
// ===========================================================================
public class AccountID implements XdrElement {
private PublicKey AccountID;

public AccountID() {}

public AccountID(PublicKey AccountID) {
this.AccountID = AccountID;
}

public PublicKey getAccountID() {
return this.AccountID;
}

public void setAccountID(PublicKey value) {
this.AccountID = value;
}

public static void encode(XdrDataOutputStream stream, AccountID encodedAccountID) throws IOException {
PublicKey.encode(stream, encodedAccountID.AccountID);
PublicKey.encode(stream, encodedAccountID.AccountID);
}

public void encode(XdrDataOutputStream stream) throws IOException {
encode(stream, this);
}
public static AccountID decode(XdrDataInputStream stream) throws IOException {
AccountID decodedAccountID = new AccountID();
decodedAccountID.AccountID = PublicKey.decode(stream);
decodedAccountID.AccountID = PublicKey.decode(stream);
return decodedAccountID;
}

@Override
public int hashCode() {
return Objects.hashCode(this.AccountID);
}

@Override
public boolean equals(Object object) {
if (object == null || !(object instanceof AccountID)) {
if (!(object instanceof AccountID)) {
return false;
}

Expand Down
Loading

0 comments on commit 6d156bd

Please sign in to comment.