/
Storage.java
65 lines (57 loc) · 1.39 KB
/
Storage.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.orhanobut.hawk;
/**
* Intermediate layer which stores the given data. Used by Hawk.
*
* <p>Use custom implementation if the built-in implementations are not enough.</p>
*
* @see SharedPreferencesStorage
*/
public interface Storage {
/**
* Put a single entry to storage
*
* @param key the name of entry to put
* @param value the value of entry
* @param <T> type of value of entry
*
* @return true if entry added successfully, otherwise false
*/
<T> boolean put(String key, T value);
/**
* Get single entry from storage
*
* @param key the name of entry to get
* @param <T> type of value of entry
*
* @return the object related to given key
*/
<T> T get(String key);
/**
* Remove single entry from storage
*
* @param key the name of entry to delete
*
* @return true if removal is successful, otherwise false
*/
boolean delete(String key);
/**
* Remove all entries in the storage
*
* @return true if clearance if successful, otherwise false
*/
boolean deleteAll();
/**
* Retrieve count of entries in the storage
*
* @return entry count in the storage
*/
long count();
/**
* Checks whether the storage contains an entry.
*
* @param key the name of entry to check
*
* @return true if the entry exists in the storage, otherwise false
*/
boolean contains(String key);
}