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 Summary
ConstructorsConstructorDescriptionPushDeviceStateImpl(String deviceUUID, PushPermission permission, PushTransport transport, boolean subscribed) Creates an instance of aPushDeviceStateImplrecord class.Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedeviceUUIDrecord component.final booleanIndicates whether some other object is "equal to" this one.Gets the device UUID, theX-iiziheader of the PN HTTP API.Gets the notification permission.Gets the transport this device would be reached through.final inthashCode()Returns a hash code value for this object.booleanChecks whether the device holds a subscription for this application that this server also holds.Returns the value of thepermissionrecord component.booleanReturns the value of thesubscribedrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thetransportrecord component.
Constructor Details
PushDeviceStateImpl
public PushDeviceStateImpl(String deviceUUID, PushPermission permission, PushTransport transport, boolean subscribed) Creates an instance of aPushDeviceStateImplrecord class.- Parameters:
deviceUUID- the value for thedeviceUUIDrecord componentpermission- the value for thepermissionrecord componenttransport- the value for thetransportrecord componentsubscribed- the value for thesubscribedrecord component
Method Details
getDeviceUUID
Description copied from interface:IPushDeviceStateGets the device UUID, theX-iiziheader of the PN HTTP API.- Specified by:
getDeviceUUIDin interfaceIPushDeviceState- Returns:
- The canonical 36-character UUID, never
null.
getPermission
Description copied from interface:IPushDeviceStateGets the notification permission.- Specified by:
getPermissionin interfaceIPushDeviceState- Returns:
- The permission, never
null;PushPermission.UNSUPPORTEDwhen the device cannot receive Push Notification at all.
getTransport
Description copied from interface:IPushDeviceStateGets the transport this device would be reached through.- Specified by:
getTransportin interfaceIPushDeviceState- Returns:
PushTransport.VAPIDfor a Browser,PushTransport.FCMfor a Cordova app, ornullwhen the device isPushPermission.UNSUPPORTED.
isSubscribed
public boolean isSubscribed()Description copied from interface:IPushDeviceStateChecks 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:
isSubscribedin interfaceIPushDeviceState- Returns:
truewhen both ends hold the subscription.
toString
hashCode
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes.deviceUUID
Returns the value of thedeviceUUIDrecord component.- Returns:
- the value of the
deviceUUIDrecord component
permission
Returns the value of thepermissionrecord component.- Returns:
- the value of the
permissionrecord component
transport
subscribed
public boolean subscribed()Returns the value of thesubscribedrecord component.- Returns:
- the value of the
subscribedrecord component