Class MemoryOllamaEndpoint
java.lang.Object
com.developer.nefarious.zjoule.plugin.memory.MemoryOllamaEndpoint
- All Implemented Interfaces:
IMemoryObject<String>
A singleton class for managing the persistence of the Ollama endpoint in Eclipse preferences.
The MemoryOllamaEndpoint
class stores, retrieves, and clears the Ollama endpoint
using the Eclipse preferences system. It follows a singleton pattern and must be initialized
before use.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
static MemoryOllamaEndpoint
Retrieves the singleton instance ofMemoryOllamaEndpoint
.static void
initialize
(IEclipseMemory eclipseMemory) Initializes the singleton instance ofMemoryOllamaEndpoint
.isEmpty()
Checks if the stored data is empty or invalid.load()
Loads the data from memory.static void
Resets the singleton instance.void
Saves the given data to memory.
-
Field Details
-
KEY
The key used for storing the Ollama endpoint in Eclipse preferences.- See Also:
-
-
Method Details
-
getInstance
Retrieves the singleton instance ofMemoryOllamaEndpoint
.- Returns:
- the singleton instance.
- Throws:
IllegalStateException
- if the instance has not been initialized.
-
initialize
Initializes the singleton instance ofMemoryOllamaEndpoint
.This method must be called before accessing
getInstance()
.- Parameters:
eclipseMemory
- theIEclipseMemory
instance to be used for preference storage.
-
resetInstance
public static void resetInstance()Resets the singleton instance.This method clears the instance reference, allowing re-initialization.
-
isEmpty
Checks if the stored data is empty or invalid.- Specified by:
isEmpty
in interfaceIMemoryObject<String>
- Returns:
true
if the stored data is empty or invalid;false
otherwise.
-
load
Loads the data from memory.- Specified by:
load
in interfaceIMemoryObject<String>
- 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<String>
- Parameters:
ollamaEndpoint
- the object of typeT
to save.
-
clear
public void clear()- Specified by:
clear
in interfaceIMemoryObject<String>
-