Class TemporaryMemoryServiceKey
java.lang.Object
com.developer.nefarious.zjoule.plugin.login.memory.TemporaryMemoryServiceKey
- All Implemented Interfaces:
ITemporaryMemoryObject
,IMemoryObject<ServiceKey>
public class TemporaryMemoryServiceKey
extends Object
implements IMemoryObject<ServiceKey>, ITemporaryMemoryObject
Manages temporary storage and retrieval of service key information during the login process.
The TemporaryMemoryServiceKey
class provides methods to save, load, and persist
temporary service key data using Eclipse preferences. It implements IMemoryObject<ServiceKey>
and ITemporaryMemoryObject
.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic TemporaryMemoryServiceKey
Retrieves the singleton instance ofTemporaryMemoryServiceKey
.static void
initialize
(IObjectSerializer objectSerializer, IEclipseMemory eclipseMemory) Initializes theTemporaryMemoryServiceKey
singleton with the specified dependencies.isEmpty()
Checks if the stored data is empty or invalid.load()
Loads the data from memory.void
persist()
Persists the temporary memory object to permanent storage.static void
Resets the singleton instance.void
save
(ServiceKey serviceKey) Saves the given data to memory.
-
Field Details
-
KEY
Key used for storing and retrieving the temporary service key in Eclipse preferences.- See Also:
-
-
Method Details
-
getInstance
Retrieves the singleton instance ofTemporaryMemoryServiceKey
.- Returns:
- the singleton instance.
- Throws:
IllegalStateException
- if the instance has not been initialized.
-
initialize
Initializes theTemporaryMemoryServiceKey
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<ServiceKey>
- Returns:
true
if the stored data is empty or invalid;false
otherwise.
-
load
Loads the data from memory.- Specified by:
load
in interfaceIMemoryObject<ServiceKey>
- Returns:
- the stored object of type
T
, ornull
if no data is found or loading fails.
-
persist
public void persist()Persists the temporary memory object to permanent storage.- Specified by:
persist
in interfaceITemporaryMemoryObject
-
save
Saves the given data to memory.- Specified by:
save
in interfaceIMemoryObject<ServiceKey>
- Parameters:
serviceKey
- the object of typeT
to save.
-