Class MemoryOllamaModel
java.lang.Object
com.developer.nefarious.zjoule.plugin.memory.MemoryOllamaModel
- All Implemented Interfaces:
IMemoryObject<OllamaModel>
Manages the storage and retrieval of ollamaModel information in memory.
The MemoryOllamaModel
class provides methods to save, load, and check
the validity of ollamaModel data stored in Eclipse preferences. It implements IMemoryObject<OllamaModel>
.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
static MemoryOllamaModel
Retrieves the singleton instance ofMemoryOllamaModel
.static void
initialize
(IObjectSerializer objectSerializer, IEclipseMemory eclipseMemory) Initializes theMemoryOllamaModel
singleton with the specified dependencies.isEmpty()
Checks if the stored data is empty or invalid.load()
Loads the data from memory.static void
Resets the singleton instance.void
save
(OllamaModel ollamaModel) Saves the given data to memory.
-
Field Details
-
KEY
Key used for storing and retrieving ollamaModel information in memory.- See Also:
-
-
Method Details
-
getInstance
Retrieves the singleton instance ofMemoryOllamaModel
.- Returns:
- the singleton instance.
- Throws:
IllegalStateException
- if the instance has not been initialized.
-
initialize
Initializes theMemoryOllamaModel
singleton with the specified dependencies.- Parameters:
objectSerializer
- the serializer for handling object serialization and deserialization.eclipseMemory
- the manager for Eclipse preferences storage.
-
resetInstance
public static void resetInstance()Resets the singleton instance. Useful for testing or reinitialization. -
isEmpty
Checks if the stored data is empty or invalid.- Specified by:
isEmpty
in interfaceIMemoryObject<OllamaModel>
- Returns:
true
if the stored data is empty or invalid;false
otherwise.
-
load
Loads the data from memory.- Specified by:
load
in interfaceIMemoryObject<OllamaModel>
- Returns:
- the stored object of type
T
, ornull
if no data is found or loading fails.
-
save
Saves the given data to memory.- Specified by:
save
in interfaceIMemoryObject<OllamaModel>
- Parameters:
ollamaModel
- the object of typeT
to save.
-
clear
public void clear()- Specified by:
clear
in interfaceIMemoryObject<OllamaModel>
-