Package ai.nexconn.chatui.base
Class MultiDataHandler
-
- All Implemented Interfaces:
public abstract class MultiDataHandler extends BaseHandler
Business logic handler with multi-type data change callbacks.
- Since:
5.10.4
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classMultiDataHandler.DataKey
-
Field Summary
Fields Modifier and Type Field Description protected volatile booleanisAlive
-
Constructor Summary
Constructors Constructor Description MultiDataHandler()
-
Method Summary
Modifier and Type Method Description voidstop()Stops the handler. final <T> voidaddDataChangeListener(@NonNull() MultiDataHandler.DataKey<T> dataKey, @NonNull() OnDataChangeListener<T> onDataChangeListener)Adds a data change listener. final <T> voidreplaceDataChangeListener(@NonNull() MultiDataHandler.DataKey<T> dataKey, @NonNull() OnDataChangeListener<T> onDataChangeListener)Replaces the data change listener. final <T> voidnotifyDataChange(@NonNull() MultiDataHandler.DataKey<T> dataKey, @NonNull() T data)Notifies data change for the specified type. final <T> voidnotifyDataError(@NonNull() MultiDataHandler.DataKey<T> dataKey, @NonNull() NCError error)Notifies a data error for the specified type. final <T> voidnotifyDataError(@NonNull() MultiDataHandler.DataKey<T> dataKey, @NonNull() NCError error, @NonNull() List<String> errorKeys)Notifies a data error for the specified type with error key list. -
-
Method Detail
-
stop
void stop()
Stops the handler.
-
addDataChangeListener
final <T> void addDataChangeListener(@NonNull() MultiDataHandler.DataKey<T> dataKey, @NonNull() OnDataChangeListener<T> onDataChangeListener)
Adds a data change listener.
- Parameters:
dataKey- the key containing the identifier and corresponding Class typeonDataChangeListener- the data change listener
-
replaceDataChangeListener
final <T> void replaceDataChangeListener(@NonNull() MultiDataHandler.DataKey<T> dataKey, @NonNull() OnDataChangeListener<T> onDataChangeListener)
Replaces the data change listener.
- Parameters:
dataKey- the key containing the identifier and corresponding Class typeonDataChangeListener- the data change listener
-
notifyDataChange
final <T> void notifyDataChange(@NonNull() MultiDataHandler.DataKey<T> dataKey, @NonNull() T data)
Notifies data change for the specified type.
- Parameters:
dataKey- the key containing the identifier and corresponding Class typedata- the data
-
notifyDataError
final <T> void notifyDataError(@NonNull() MultiDataHandler.DataKey<T> dataKey, @NonNull() NCError error)
Notifies a data error for the specified type.
- Parameters:
dataKey- the key containing the identifier and corresponding Class typeerror- the error
-
notifyDataError
final <T> void notifyDataError(@NonNull() MultiDataHandler.DataKey<T> dataKey, @NonNull() NCError error, @NonNull() List<String> errorKeys)
Notifies a data error for the specified type with error key list.
- Parameters:
dataKey- the key containing the identifier and corresponding Class typeerror- the errorerrorKeys- the list of error keys
-
-
-
-