Record Class PushDeviceStateImpl

java.lang.Object
java.lang.Record
com.iizix.server.push.api.PushDeviceStateImpl
Record Components:
deviceUUID - The push UUID the channel reported.
permission - The permission the device answered with.
transport - The transport the device would be reached through, or null.
subscribed - Whether the device holds the subscription AND the server holds a row for the session's user, the application and the device.
All Implemented Interfaces:
IPushDeviceState

public record PushDeviceStateImpl(String deviceUUID, PushPermission permission, PushTransport transport, boolean subscribed) extends Record implements IPushDeviceState
The IPushDeviceState a queryDeviceState answers with (P4-06): the client's reply to QUERY_STATE combined with the server's own store, so that isSubscribed is true only when both ends hold the subscription (PUSH-PROPS-DESIGN section 4.2).
Author:
Christopher Mindus
  • Constructor Details

    • PushDeviceStateImpl

      public PushDeviceStateImpl(String deviceUUID, PushPermission permission, PushTransport transport, boolean subscribed)
      Creates an instance of a PushDeviceStateImpl record class.
      Parameters:
      deviceUUID - the value for the deviceUUID record component
      permission - the value for the permission record component
      transport - the value for the transport record component
      subscribed - the value for the subscribed record component
  • Method Details

    • getDeviceUUID

      public String getDeviceUUID()
      Description copied from interface: IPushDeviceState
      Gets the device UUID, the X-iizi header of the PN HTTP API.
      Specified by:
      getDeviceUUID in interface IPushDeviceState
      Returns:
      The canonical 36-character UUID, never null.
    • getPermission

      public PushPermission getPermission()
      Description copied from interface: IPushDeviceState
      Gets the notification permission.
      Specified by:
      getPermission in interface IPushDeviceState
      Returns:
      The permission, never null; PushPermission.UNSUPPORTED when the device cannot receive Push Notification at all.
    • getTransport

      public PushTransport getTransport()
      Description copied from interface: IPushDeviceState
      Gets the transport this device would be reached through.
      Specified by:
      getTransport in interface IPushDeviceState
      Returns:
      PushTransport.VAPID for a Browser, PushTransport.FCM for a Cordova app, or null when the device is PushPermission.UNSUPPORTED.
    • isSubscribed

      public boolean isSubscribed()
      Description copied from interface: IPushDeviceState
      Checks whether the device holds a subscription for this application that this server also holds. A device subscription the server does not know, or a stored row whose device has lost its subscription, is not subscribed.
      Specified by:
      isSubscribed in interface IPushDeviceState
      Returns:
      true when both ends hold the subscription.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • deviceUUID

      public String deviceUUID()
      Returns the value of the deviceUUID record component.
      Returns:
      the value of the deviceUUID record component
    • permission

      public PushPermission permission()
      Returns the value of the permission record component.
      Returns:
      the value of the permission record component
    • transport

      public PushTransport transport()
      Returns the value of the transport record component.
      Returns:
      the value of the transport record component
    • subscribed

      public boolean subscribed()
      Returns the value of the subscribed record component.
      Returns:
      the value of the subscribed record component