StringConverter.
The history is maintained in a list that is limited by a specified maximum size. If the limit is exceeded, the oldest items are removed. The history management includes functionalities to add, remove, clear, and retrieve history items. Changes to the history are automatically persisted to the Preferences store using the specified delimiter and preferences key.
This class is particularly useful for applications needing to maintain a persistent, manageable history of user actions or data entries, where entries must be stored across sessions in a simple and effective manner.
Instances of this class are not thread-safe. If concurrent access is required, it should be managed externally.
HistoryManager, StringConverter
| Modifier and Type | Field and Description |
|---|---|
| private final StringConverter | |
| public static String | DELIMITER
Using Unicode Record Separator as delimiter. |
| private final String | |
| private static final Logger | |
| private final Preferences |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | loadHistory()
Implements abstract com. Loads the history items from the preferences. |
| protected void | storeHistory()
Implements abstract com. Stores the history items in the preferences. |
| converter | back to summary |
|---|---|
| private final StringConverter<T> converter | |
| DELIMITER | back to summary |
|---|---|
| public static String DELIMITER Using Unicode Record Separator as delimiter. This character is not likely to be used in the history items. | |
| key | back to summary |
|---|---|
| private final String key | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| preferences | back to summary |
|---|---|
| private final Preferences preferences | |
| PreferencesHistoryManager | back to summary |
|---|---|
| public PreferencesHistoryManager(Preferences preferences, String key, StringConverter<T> converter) | |
| loadHistory | back to summary |
|---|---|
| protected void loadHistory() Implements abstract com. Loads the history items from the preferences.
| |
| storeHistory | back to summary |
|---|---|
| protected void storeHistory() Implements abstract com. Stores the history items in the preferences.
| |