Class Entity<D>

java.lang.Object
com.mxraven.admin.Entity<D>
Type Parameters:
D - the wire record backing this entity
Direct Known Subclasses:
APIKey, AutoReplyTemplate, Domain, InboundRoute, Listener, RecipientSet, RecipientSetMember, SmtpForwardDestination, SmtpRelay, StorageIntegration, TenantIdentityProvider, TenantSuppression, WebhookEndpoint

public abstract class Entity<D> extends Object
Base for hydrated resource entities. An entity wraps the wire record D with the client and path needed to act on the resource, plus local delete state.

Reads return a snapshot; call reload() (where supported) for fresh state. isDeleted() is local bookkeeping for deletes performed through this instance — it cannot observe deletes made elsewhere.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final AdminClient
    The client used to issue requests for this entity.
    protected final D
    Raw wire record backing this entity.
    protected final String
    Client-relative path of this resource.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Entity(AdminClient client, String path, D data)
    Creates an entity bound to a client, path, and backing data.
    protected
    Entity(AdminClient client, String path, D data, boolean deleted)
    Creates an entity bound to a client, path, backing data, and delete state.
  • Method Summary

    Modifier and Type
    Method
    Description
    The raw wire record backing this entity.
    boolean
    Delete this resource.
    boolean
    Whether this entity has been deleted through this instance.
    protected String
    Returns the client-relative path of this resource.

    Methods inherited from class java.lang.Object

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

    • client

      protected final AdminClient client
      The client used to issue requests for this entity.
    • path

      protected final String path
      Client-relative path of this resource.
    • data

      protected final D data
      Raw wire record backing this entity.
  • Constructor Details

    • Entity

      protected Entity(AdminClient client, String path, D data)
      Creates an entity bound to a client, path, and backing data.
      Parameters:
      client - admin client used for requests
      path - resource path
      data - backing wire record
    • Entity

      protected Entity(AdminClient client, String path, D data, boolean deleted)
      Creates an entity bound to a client, path, backing data, and delete state.
      Parameters:
      client - admin client used for requests
      path - resource path
      data - backing wire record
      deleted - whether the entity is considered deleted
  • Method Details

    • data

      public D data()
      The raw wire record backing this entity.
      Returns:
      the underlying wire record
    • isDeleted

      public boolean isDeleted()
      Whether this entity has been deleted through this instance. Local state only; not authoritative server state.
      Returns:
      true if deleted through this instance
    • delete

      public boolean delete() throws IOException
      Delete this resource. Idempotent: once this instance has deleted it, further calls are a local no-op.
      Returns:
      true once the resource has been deleted through this instance
      Throws:
      IOException - if the delete request fails or is interrupted
    • path

      protected String path()
      Returns the client-relative path of this resource.
      Returns:
      the resource path