Class CustomSettingsService
-
- All Implemented Interfaces:
public final class CustomSettingsService<R extends CustomSettingsEntity> extends MobileService
Represents the service to deal with custom setting exchanges, loading/storing/updating/deleting custom settings. All operations will need an instance of CustomSettingsEntity.
For all the operations, 'keyPath' will be needed for each CustomSettingsEntity, which is the 'configurationName' of each CustomSettingsEntity.
For 'load' and 'auto load' operations, besides 'keyPath', a 'parser' is also needed to convert a JSON string to typed custom settings. The parser will be passed in the parameter of parse.
If 'auto' retrieve custom setting feature is not needed, keyPath, parse and autoCustomSettingsLoadListener can be omitted.
-
-
Field Summary
Fields Modifier and Type Field Description private Application
application
private String
apiKey
-
Constructor Summary
Constructors Constructor Description CustomSettingsService(SettingsTarget target, String keyPath, Function1<String, R> parse, ServiceListener<R> autoCustomSettingsLoadListener)
CustomSettingsService(SettingsTarget target, String keyPath, Function1<String, R> parse)
CustomSettingsService(SettingsTarget target, String keyPath)
CustomSettingsService(SettingsTarget target)
CustomSettingsService()
-
Method Summary
Modifier and Type Method Description Unit
init(Application application, String apiKey)
Initializes the mobile service Unit
onStateChange(ApplicationState state)
Notified when application state changes. final <T extends CustomSettingsEntity> Job
loadCustomSettings(SettingsTarget target, String keyPath, Function1<String, T> parser, ServiceListener<T> listener)
Loads custom setting identified by keyPath. final <T extends CustomSettingsEntity> ServiceResult<T>
loadCustomSettings(SettingsTarget target, String keyPath, Function1<String, T> parse)
Loads custom setting entity identified by keyPath within a coroutine. final <T extends CustomSettingsEntity> Job
storeCustomPolicy(T entity, SettingsTarget target, ServiceListener<T> listener)
Creates or updates the given entity to mobile server, the listener will be notified with the result on the main thread. final <T extends CustomSettingsEntity> ServiceResult<T>
storeCustomPolicy(T entity, SettingsTarget target)
Creates or updates the given entity to mobile server. final Job
deleteCustomPolicy(String keyPath, SettingsTarget target, ServiceListener<Void> listener)
Deletes a custom setting entity on mobile server, the result will notified to listener on the main thread. final ServiceResult<Void>
deleteCustomPolicy(String keyPath, SettingsTarget target)
Deletes a custom setting entity on mobile server. -
Methods inherited from class com.sap.cloud.mobile.foundation.mobileservices.MobileService
enableNetworkPolicy, getApiKey, getApplication, isApplicationInitialized, reset, setApiKey, setApplication
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
CustomSettingsService
CustomSettingsService(SettingsTarget target, String keyPath, Function1<String, R> parse, ServiceListener<R> autoCustomSettingsLoadListener)
-
CustomSettingsService
CustomSettingsService(SettingsTarget target, String keyPath, Function1<String, R> parse)
-
CustomSettingsService
CustomSettingsService(SettingsTarget target, String keyPath)
-
CustomSettingsService
CustomSettingsService(SettingsTarget target)
-
CustomSettingsService
CustomSettingsService()
-
-
Method Detail
-
init
Unit init(Application application, String apiKey)
Initializes the mobile service
-
onStateChange
Unit onStateChange(ApplicationState state)
Notified when application state changes. This function will be called on Main thread.
-
loadCustomSettings
final <T extends CustomSettingsEntity> Job loadCustomSettings(SettingsTarget target, String keyPath, Function1<String, T> parser, ServiceListener<T> listener)
-
loadCustomSettings
final <T extends CustomSettingsEntity> ServiceResult<T> loadCustomSettings(SettingsTarget target, String keyPath, Function1<String, T> parse)
-
storeCustomPolicy
final <T extends CustomSettingsEntity> Job storeCustomPolicy(T entity, SettingsTarget target, ServiceListener<T> listener)
-
storeCustomPolicy
final <T extends CustomSettingsEntity> ServiceResult<T> storeCustomPolicy(T entity, SettingsTarget target)
Creates or updates the given entity to mobile server.
-
deleteCustomPolicy
final Job deleteCustomPolicy(String keyPath, SettingsTarget target, ServiceListener<Void> listener)
Deletes a custom setting entity on mobile server, the result will notified to listener on the main thread.
-
deleteCustomPolicy
final ServiceResult<Void> deleteCustomPolicy(String keyPath, SettingsTarget target)
Deletes a custom setting entity on mobile server.
-
-
-
-