public class Channel
extends java.lang.Object
implements java.beans.PropertyChangeListener
Modifier and Type | Class and Description |
---|---|
static class |
Channel.Builder
Builder pattern implementation for the Channel class
|
static class |
Channel.NotificationType
Possible notification message types arriving from the Telepat cloud
|
Constructor and Description |
---|
Channel(Channel.Builder builder) |
Channel(java.lang.String identifier) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
add(TelepatBaseModel object)
Create a new object on this Telepat channel
|
java.util.HashMap<java.lang.String,java.lang.Object> |
getCreateRequestBody(TelepatBaseModel object) |
java.util.HashMap<java.lang.String,java.lang.Object> |
getDeleteRequestBody(TelepatBaseModel object) |
java.util.HashMap<java.lang.String,java.lang.Object> |
getSubscribingRequestBody() |
java.lang.String |
getSubscriptionIdentifier()
Get a string representation of this channels characteristics
|
java.util.HashMap<java.lang.String,java.lang.Object> |
getUpdateRequestBody(PendingPatch pendingPatch) |
void |
notifyStoredObjects()
Send created notifications for currently locally stored objects in this channel.
|
void |
processNotification(TransportNotification notification)
Process an incoming notification from a network transport
|
void |
propertyChange(java.beans.PropertyChangeEvent event)
Listener for modified objects (previously emitted by this channel)
|
void |
remove(TelepatBaseModel object)
Deletes an object from this Telepat channel
|
void |
setOnChannelEventListener(OnChannelEventListener listener)
Set the listener object where events of this channel will be notified
|
void |
subscribe()
Create a new subscription with the Telepat Cloud instance.
|
void |
unsubscribe()
Unsubscribes this device from receiving further updates from this channel
|
public Channel(java.lang.String identifier)
public Channel(Channel.Builder builder)
public void subscribe()
public java.util.HashMap<java.lang.String,java.lang.Object> getSubscribingRequestBody()
public java.util.HashMap<java.lang.String,java.lang.Object> getCreateRequestBody(TelepatBaseModel object)
public java.util.HashMap<java.lang.String,java.lang.Object> getUpdateRequestBody(PendingPatch pendingPatch)
public java.util.HashMap<java.lang.String,java.lang.Object> getDeleteRequestBody(TelepatBaseModel object)
public void unsubscribe()
public java.lang.String add(TelepatBaseModel object)
object
- an object of a class extending TelepatBaseModel
public void remove(TelepatBaseModel object)
object
- an object of a class extending TelepatBaseModel
public void setOnChannelEventListener(OnChannelEventListener listener)
listener
- an object of a class implementing OnChannelEventListener
public java.lang.String getSubscriptionIdentifier()
public void notifyStoredObjects()
public void processNotification(TransportNotification notification)
notification
- the received notificationpublic void propertyChange(java.beans.PropertyChangeEvent event)
propertyChange
in interface java.beans.PropertyChangeListener
event
- the property change event