-
- All Implemented Interfaces:
-
com.onesignal.common.events.IEventNotifier,com.onesignal.common.modeling.IModelChangedHandler,com.onesignal.common.modeling.IModelStore
public class SimpleModelStore<TModel extends Model> extends ModelStore<TModel>
A simple model store is a concrete implementation of the ModelStore which provides a basic implementation of the create method. Specifically, it will instantiate a new instance of the TModel via the lambda _create passed in during initialization.
-
-
Field Summary
Fields Modifier and Type Field Description private final BooleanhasSubscribersprivate final Stringname
-
Constructor Summary
Constructors Constructor Description SimpleModelStore(Function0<TModel> _create, String name, IPreferencesService _prefs)
-
Method Summary
Modifier and Type Method Description BooleangetHasSubscribers()final StringgetName()The persistable name of the model store. TModelcreate(JSONObject jsonObject)Create a new instance of the model and add it to the store. -
Methods inherited from class com.onesignal.common.modeling.SimpleModelStore
add, add, clear, get, list, onChanged, persist, remove, replaceAll, subscribe, unsubscribe -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
SimpleModelStore
SimpleModelStore(Function0<TModel> _create, String name, IPreferencesService _prefs)
-
-
Method Detail
-
getHasSubscribers
Boolean getHasSubscribers()
-
getName
final String getName()
The persistable name of the model store. If not specified no persisting will occur.
-
create
TModel create(JSONObject jsonObject)
Create a new instance of the model and add it to the store. The new instance is not added to the model store, because it may not yet have an Model.id which is required.
- Parameters:
jsonObject- The optional JSONObject to initialize the new model with.
-
-
-
-