Class TrustLineAsset

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

public class TrustLineAsset extends Object implements XdrElement
TrustLineAsset's original definition in the XDR file is:
 union TrustLineAsset switch (AssetType type)
 {
 case ASSET_TYPE_NATIVE: // Not credit
     void;

 case ASSET_TYPE_CREDIT_ALPHANUM4:
     AlphaNum4 alphaNum4;

 case ASSET_TYPE_CREDIT_ALPHANUM12:
     AlphaNum12 alphaNum12;

 case ASSET_TYPE_POOL_SHARE:
     PoolID liquidityPoolID;

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

    • TrustLineAsset

      public TrustLineAsset()
    • TrustLineAsset

      public TrustLineAsset(AssetType discriminant, AlphaNum4 alphaNum4, AlphaNum12 alphaNum12, PoolID liquidityPoolID)
      Creates a new TrustLineAsset instance.
      Parameters:
      discriminant - the discriminant field value
      alphaNum4 - the alphaNum4 field value
      alphaNum12 - the alphaNum12 field value
      liquidityPoolID - the liquidityPoolID 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 TrustLineAsset decode(XdrDataInputStream stream, int maxDepth) throws IOException
      Throws:
      IOException
    • decode

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

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

      public static TrustLineAsset 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 TrustLineAsset fromJson(String json)
    • builder

      public static TrustLineAsset.TrustLineAssetBuilder builder()
    • toBuilder

    • getDiscriminant

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

      public AlphaNum4 getAlphaNum4()
      Value of the alphaNum4 field.
      Returns:
      the alphaNum4 field value
    • getAlphaNum12

      public AlphaNum12 getAlphaNum12()
      Value of the alphaNum12 field.
      Returns:
      the alphaNum12 field value
    • getLiquidityPoolID

      public PoolID getLiquidityPoolID()
      Value of the liquidityPoolID field.
      Returns:
      the liquidityPoolID field value
    • setDiscriminant

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

      public void setAlphaNum4(AlphaNum4 alphaNum4)
      Value of the alphaNum4 field.
      Parameters:
      alphaNum4 - the alphaNum4 field value
    • setAlphaNum12

      public void setAlphaNum12(AlphaNum12 alphaNum12)
      Value of the alphaNum12 field.
      Parameters:
      alphaNum12 - the alphaNum12 field value
    • setLiquidityPoolID

      public void setLiquidityPoolID(PoolID liquidityPoolID)
      Value of the liquidityPoolID field.
      Parameters:
      liquidityPoolID - the liquidityPoolID 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