Package com.zopim.android.sdk.data
Class Path<T>
- java.lang.Object
-
- java.util.Observable
-
- com.zopim.android.sdk.data.Path<T>
-
- All Implemented Interfaces:
- ObservableTrigger
- Direct Known Subclasses:
- ConnectionPath, LivechatAccountPath, LivechatAgentsPath, LivechatChatLogPath, LivechatChattingStatusPath, LivechatDepartmentsPath, LivechatFileSendingPath, LivechatFormsPath, LivechatProfilePath
public abstract class Path<T> extends java.util.Observable implements ObservableTrigger
Definition of a data path in chat data source.Used in specific implementation of a data path representing a single source branch. Eg. connectivity state in
ConnectionPath
-
-
Constructor Summary
Constructors Constructor and Description Path()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description void
addObserver(java.util.Observer o)
void
broadcast()
Will notify all observers that all data has changed on this data path.protected void
broadcast(T data)
Will notify all observers with the data passed as parameter.void
deleteObserver(java.util.Observer o)
void
deleteObservers()
protected void
finalize()
abstract T
getData()
Gets the path data in it's current stateprotected boolean
isClearRequired(java.lang.String json)
Convenience method for interpreting json message update to the data path.void
notifyObservers(java.lang.Object object)
Deprecated.void
trigger()
Triggers an update from an observable
-
-
-
Field Detail
-
DEBUG
protected static final boolean DEBUG
- See Also:
- Constant Field Values
-
data
protected T data
Local variable keeping the data reference
-
-
Method Detail
-
getData
public abstract T getData()
Gets the path data in it's current state- Returns:
- path data pojo object
-
isClearRequired
protected boolean isClearRequired(java.lang.String json)
Convenience method for interpreting json message update to the data path.It's per protocol definition that data gets cleared if json update arrives as null or string literal 'null'
- Parameters:
json
- that gets interpreted- Returns:
- true if data should be cleared, false otherwise
- See Also:
WebWidgetListener.msg(String)
,com.zopim.android.sdk.data.WebWidgetListener#shouldOverrideUrlLoading(android.webkit.WebView, String)
-
trigger
public void trigger()
Description copied from interface:ObservableTrigger
Triggers an update from an observable- Specified by:
trigger
in interfaceObservableTrigger
-
notifyObservers
@Deprecated public final void notifyObservers(java.lang.Object object)
Deprecated.This method is discouraged, usebroadcast(T data)
to notify your observers.Parametrized object must be of specified generic type T, or broadcast will be aborted.
- Overrides:
notifyObservers
in classjava.util.Observable
- Parameters:
object
- update
-
broadcast
protected void broadcast(T data)
Will notify all observers with the data passed as parameter. If nobody is listening there will be no broadcast.It will also mark this observable as changed so that Observer receives the update.
- Parameters:
data
- to broadcast
-
broadcast
public void broadcast()
Will notify all observers that all data has changed on this data path.
-
finalize
protected void finalize() throws java.lang.Throwable
- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
addObserver
public void addObserver(java.util.Observer o)
- Overrides:
addObserver
in classjava.util.Observable
-
deleteObserver
public void deleteObserver(java.util.Observer o)
- Overrides:
deleteObserver
in classjava.util.Observable
-
deleteObservers
public void deleteObservers()
- Overrides:
deleteObservers
in classjava.util.Observable
-
-