@Singleton
public class DeviceModelCache
extends java.lang.Object
DeviceModel objects. Works only if there is Internet connection.
Use DeviceModelCache to determine appropriate model for your device.
Example: call getModelById(String) using modelId from Device.getModelId()| Constructor and Description |
|---|
DeviceModelCache(DeviceModelsApi modelsApi,
UserApi userApi) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
available() |
java.util.List<DeviceModel> |
getAll() |
DeviceModel |
getModelById(java.lang.String modelId)
Returns
DeviceModel depending on specified modelId. |
DeviceModel |
getModelByName(java.lang.String name)
Returns
DeviceModel depending on specified modelId. |
DeviceModel |
getModelByName(java.lang.String name,
boolean equals)
Returns
DeviceModel depending on specified modelId. |
DeviceModel |
getModelByName(java.lang.String name,
boolean equals,
boolean caseSensitive)
Returns
DeviceModel depending on specified modelId. |
boolean |
isLoading()
Returns cache state.
|
void |
refresh()
Refresh device model cache.
|
@Inject public DeviceModelCache(DeviceModelsApi modelsApi, UserApi userApi)
public boolean isLoading()
getModelById(String)public boolean available()
public DeviceModel getModelById(java.lang.String modelId) throws DeviceModelsException
DeviceModel depending on specified modelId.
Obtain modelId parameter from Device.getModelId()modelId - Device.getModelId()DeviceModel if one is found, null otherwiseDeviceModelsExceptionpublic DeviceModel getModelByName(java.lang.String name) throws DeviceModelsCacheException
DeviceModel depending on specified modelId.
Search is NOT case sensitive and matches the results with equals.name - model nameDeviceModel if one is found, null otherwiseDeviceModelsCacheExceptionpublic DeviceModel getModelByName(java.lang.String name, boolean equals) throws DeviceModelsCacheException
DeviceModel depending on specified modelId. This search is NOT case sensitive.name - model nameequals - if true names will be matched only if they are equalDeviceModel if one is found, null otherwiseDeviceModelsCacheExceptionpublic DeviceModel getModelByName(java.lang.String name, boolean equals, boolean caseSensitive) throws DeviceModelsCacheException
DeviceModel depending on specified modelId.name - model nameequals - if true names will be matched only if they are equalcaseSensitive - true if matching should be case sensitiveDeviceModel if one is found, null otherwiseDeviceModelsCacheExceptionpublic java.util.List<DeviceModel> getAll() throws DeviceModelsCacheException
DeviceModel supported on Relayr platform ordered by name.DeviceModelsCacheExceptionpublic void refresh()