Class HookEntityId

java.lang.Object
com.hedera.hashgraph.sdk.HookEntityId

public class HookEntityId extends Object
The ID of an entity using a hook.

This class represents the HookEntityId protobuf message, which can be either an account ID or a contract ID.

  • Constructor Details

    • HookEntityId

      public HookEntityId(AccountId accountId)
      Create a HookEntityId with an account ID.
      Parameters:
      accountId - the account ID
    • HookEntityId

      public HookEntityId(ContractId contractId)
      Create a HookEntityId with a contract ID.
      Parameters:
      contractId - the contract ID
  • Method Details

    • getAccountId

      public AccountId getAccountId()
      Get the account ID.
      Returns:
      the account ID, or null if this entity is a contract
    • getContractId

      public ContractId getContractId()
      Get the contract ID.
      Returns:
      the contract ID, or null if this entity is an account
    • isAccount

      public boolean isAccount()
      Check if this entity is an account.
      Returns:
      true if this entity is an account, false if it's a contract
    • isContract

      public boolean isContract()
      Check if this entity is a contract.
      Returns:
      true if this entity is a contract, false if it's an account
    • toProtobuf

      HookEntityId toProtobuf()
      Convert this HookEntityId to a protobuf message.
      Returns:
      the protobuf HookEntityId
    • fromProtobuf

      static HookEntityId fromProtobuf(HookEntityId proto)
      Create a HookEntityId from a protobuf message.
      Parameters:
      proto - the protobuf HookEntityId
      Returns:
      a new HookEntityId instance
    • 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