Interface EntityAwareMemory
- All Superinterfaces:
DataMemory<String>
- All Known Implementing Classes:
EntityDataMemory
An entity-aware extension of
DataMemory that enables the storage and retrieval
of complex domain objects using structured mapping logic.
* Note: This is an experimental feature and is currently considered unstable. It provides a high-level abstraction for interacting with entities directly, abstracting away the underlying serialization and flattening processes.
*Implementations must provide a MapperOperatorContract to handle the
translation between raw memory paths and strongly-typed objects.
- Since:
- 0.3
- Author:
- a8kj7sea
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> Optional<T> Retrieves and reconstructs an object of the specified type from the memory.Retrieves the mapper service responsible for converting entities to and from memory-compatible structures.default <T> voidPersists an arbitrary object into the memory under the specified path.Methods inherited from interface me.a8kj.config.template.memory.DataMemory
clear, contains, get, get, getBoolean, getDouble, getInt, getKeys, getOptional, getProcessor, getString, getString, getStringList, getStringList, set, transform
-
Method Details
-
getMapperService
MapperOperatorContract getMapperService()Retrieves the mapper service responsible for converting entities to and from memory-compatible structures.- Returns:
- the
MapperOperatorContractinstance used by this memory.
-
setEntity
Persists an arbitrary object into the memory under the specified path.This method delegates the serialization and flattening logic to the internal mapper service.
- Type Parameters:
T- the type of the entity.- Parameters:
path- the base configuration path (e.g., "user.profile") where the entity will be stored.entity- the domain object instance to store.
-
getEntity
Retrieves and reconstructs an object of the specified type from the memory.This method delegates the unflattening and deserialization logic to the internal mapper service.
- Type Parameters:
T- the expected type of the reconstructed entity.- Parameters:
path- the base configuration path where the entity data resides.type- the class literal of the entity type to load.- Returns:
- an
Optionalcontaining the reconstructed entity, orOptional.empty()if the entity could not be loaded.
-