Class IdGenerator

java.lang.Object
org.symbol.sdk.symbol.IdGenerator

public final class IdGenerator extends Object
IdGenerator
Mosaic and namespace identifier generation. All identifiers are 64-bit unsigned values, represented as the raw long bit pattern (so ids >= 2^63 are negative; interpret via Long.toUnsignedString(long)).
  • Method Details

    • generateMosaicId

      public static long generateMosaicId(Address ownerAddress, long nonce)
      IdGenerator.generateMosaicId
      Generates a mosaic id from an owner address and a nonce.
      Parameters:
      ownerAddress - Owner address.
      nonce - Nonce.
      Returns:
      Computed mosaic id (high bit cleared).
    • generateNamespaceId

      public static long generateNamespaceId(String name, long parentNamespaceId)
      IdGenerator.generateNamespaceId
      Generates a namespace id from a name and an optional parent namespace id.
      Parameters:
      name - Namespace name.
      parentNamespaceId - Parent namespace id (use 0 for root).
      Returns:
      Computed namespace id (high bit set).
    • generateNamespaceId

      public static long generateNamespaceId(String name)
      IdGenerator.generateNamespaceId
      Generates a namespace id with no parent.
      Parameters:
      name - Namespace name.
      Returns:
      Computed namespace id.
    • isMosaicAlias

      public static boolean isMosaicAlias(long mosaicId)
      IdGenerator.isMosaicAlias
      Determines if mosaicId is an alias.
      Parameters:
      mosaicId - Mosaic id to check.
      Returns:
      true if the specified mosaic id is an alias.
    • isValidNamespaceName

      public static boolean isValidNamespaceName(String name)
      IdGenerator.isValidNamespaceName
      Returns true if a name is a valid namespace name.
      Parameters:
      name - Namespace name to check.
      Returns:
      true if the specified name is valid.
    • generateNamespacePath

      public static List<Long> generateNamespacePath(String fullyQualifiedName)
      IdGenerator.generateNamespacePath
      Parses a fully qualified namespace name into a path of namespace ids.
      Parameters:
      fullyQualifiedName - Fully qualified namespace name (dot-separated).
      Returns:
      Computed namespace path.
    • generateMosaicAliasId

      public static long generateMosaicAliasId(String fullyQualifiedName)
      IdGenerator.generateMosaicAliasId
      Generates a mosaic id from a fully qualified mosaic alias name.
      Parameters:
      fullyQualifiedName - Fully qualified mosaic name.
      Returns:
      Computed mosaic id.