Class TenantId

java.lang.Object
com.yworkflow.common.tenant.TenantId

public final class TenantId extends Object
Represents a tenant identifier in the yWorkflow system. TenantId is used for multi-tenancy support, allowing the workflow engine to isolate workflow data and operations between different tenants.

TenantId is an immutable value object that encapsulates a tenant identifier string. It provides type safety and validation for tenant identification throughout the workflow system.

Multi-tenancy is essential for SaaS applications where multiple organizations or customers share the same workflow engine instance. Each tenant's workflows, instances, and data are completely isolated from other tenants.

Since:
1.0
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final TenantId
    Represents an empty tenant ID, used when no specific tenant is specified.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compares this TenantId with another object for equality.
    Returns the string value of this tenant ID.
    int
    Returns the hash code for this TenantId based on its string value.
    static TenantId
    Creates a new TenantId instance with the specified value.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • EMPTY

      public static final TenantId EMPTY
      Represents an empty tenant ID, used when no specific tenant is specified. This is useful for single-tenant scenarios or when tenant information is not available.
  • Method Details

    • getValue

      public String getValue()
      Returns the string value of this tenant ID.
      Returns:
      the tenant identifier string
    • tenantId

      public static TenantId tenantId(String value)
      Creates a new TenantId instance with the specified value. The value is validated to ensure it meets the requirements for tenant identifiers.
      Parameters:
      value - the tenant identifier string
      Returns:
      a new TenantId instance
      Throws:
      IllegalArgumentException - if the value is invalid
    • equals

      public boolean equals(Object o)
      Compares this TenantId with another object for equality. Two TenantId instances are equal if they have the same string value.
      Overrides:
      equals in class Object
      Parameters:
      o - the object to compare with
      Returns:
      true if the objects are equal, false otherwise
    • hashCode

      public int hashCode()
      Returns the hash code for this TenantId based on its string value.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code for this TenantId