Class AssetCode

java.lang.Object
org.stellar.sdk.xdr.AssetCode
All Implemented Interfaces:
XdrElement

public class AssetCode extends Object implements XdrElement
AssetCode's original definition in the XDR file is:
 union AssetCode switch (AssetType type)
 {
 case ASSET_TYPE_CREDIT_ALPHANUM4:
     AssetCode4 assetCode4;

 case ASSET_TYPE_CREDIT_ALPHANUM12:
     AssetCode12 assetCode12;

     // add other asset types here in the future
 };
 
  • Constructor Details

    • AssetCode

      public AssetCode()
    • AssetCode

      public AssetCode(AssetType discriminant, AssetCode4 assetCode4, AssetCode12 assetCode12)
      Creates a new AssetCode instance.
      Parameters:
      discriminant - the discriminant field value
      assetCode4 - the assetCode4 field value
      assetCode12 - the assetCode12 field value
  • Method Details

    • encode

      public void encode(XdrDataOutputStream stream) throws IOException
      Description copied from interface: XdrElement
      Encodes this value to XDR and writes it to the provided stream.
      Specified by:
      encode in interface XdrElement
      Parameters:
      stream - the destination XDR output stream
      Throws:
      IOException - if an I/O error occurs while writing the value
    • decode

      public static AssetCode decode(XdrDataInputStream stream, int maxDepth) throws IOException
      Throws:
      IOException
    • decode

      public static AssetCode decode(XdrDataInputStream stream) throws IOException
      Throws:
      IOException
    • fromXdrBase64

      public static AssetCode fromXdrBase64(String xdr) throws IOException
      Throws:
      IOException
    • fromXdrByteArray

      public static AssetCode fromXdrByteArray(byte[] xdr) throws IOException
      Throws:
      IOException
    • toJson

      public String toJson()
      Description copied from interface: XdrElement
      Serializes this value to JSON.
      Specified by:
      toJson in interface XdrElement
      Returns:
      the JSON representation of this value
    • fromJson

      public static AssetCode fromJson(String json)
    • builder

      public static AssetCode.AssetCodeBuilder builder()
    • toBuilder

      public AssetCode.AssetCodeBuilder toBuilder()
    • getDiscriminant

      public AssetType getDiscriminant()
      Value of the discriminant field.
      Returns:
      the discriminant field value
    • getAssetCode4

      public AssetCode4 getAssetCode4()
      Value of the assetCode4 field.
      Returns:
      the assetCode4 field value
    • getAssetCode12

      public AssetCode12 getAssetCode12()
      Value of the assetCode12 field.
      Returns:
      the assetCode12 field value
    • setDiscriminant

      public void setDiscriminant(AssetType discriminant)
      Value of the discriminant field.
      Parameters:
      discriminant - the discriminant field value
    • setAssetCode4

      public void setAssetCode4(AssetCode4 assetCode4)
      Value of the assetCode4 field.
      Parameters:
      assetCode4 - the assetCode4 field value
    • setAssetCode12

      public void setAssetCode12(AssetCode12 assetCode12)
      Value of the assetCode12 field.
      Parameters:
      assetCode12 - the assetCode12 field value
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object