Class NftId

java.lang.Object
com.hedera.hashgraph.sdk.NftId
All Implemented Interfaces:
Comparable<NftId>

public class NftId extends Object implements Comparable<NftId>
The (non-fungible) token of which this NFT is an instance
  • Field Details

    • tokenId

      public final TokenId tokenId
      The (non-fungible) token of which this NFT is an instance
    • serial

      @Nonnegative public final long serial
      The unique identifier of this instance
  • Constructor Details

    • NftId

      public NftId(TokenId tokenId, @Nonnegative long serial)
      Constructor.
      Parameters:
      tokenId - the token id
      serial - the serial number
  • Method Details

    • fromString

      public static NftId fromString(String id)
      Create a new nft id from a string.
      Parameters:
      id - the string representation
      Returns:
      the new nft id
    • fromProtobuf

      static NftId fromProtobuf(NftID nftId)
      Create a new ntf id from a protobuf.
      Parameters:
      nftId - the protobuf representation
      Returns:
      the new nft id
    • fromBytes

      public static NftId fromBytes(byte[] bytes) throws com.google.protobuf.InvalidProtocolBufferException
      Create a new nft id from a byte array.
      Parameters:
      bytes - the byte array
      Returns:
      the new nft id
      Throws:
      com.google.protobuf.InvalidProtocolBufferException - when there is an issue with the protobuf
    • toProtobuf

      NftID toProtobuf()
      Create the protobuf.
      Returns:
      a protobuf representation
    • toBytes

      public byte[] toBytes()
      Create the byte array.
      Returns:
      a byte array representation
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toStringWithChecksum

      public String toStringWithChecksum(Client client)
      Generate a string representation with checksum.
      Parameters:
      client - the configured client
      Returns:
      the string representation with checksum
    • hashCode

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

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

      public int compareTo(NftId o)
      Specified by:
      compareTo in interface Comparable<NftId>