Class InMemoryGraphProvider
java.lang.Object
org.episteme.core.util.persistence.InMemoryGraphProvider
- All Implemented Interfaces:
GraphProvider
@AutoService(GraphProvider.class)
public class InMemoryGraphProvider
extends Object
implements GraphProvider
In-memory implementation of
GraphProvider.
This implementation is thread-safe and intended for testing and small-scale persistence needs.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> voiddelete(T entity) Deletes an entity from the persistent store.getName()Returns the unique name of this provider.<T> TLoads an entity from the persistent store.<T> List<T> Queries the persistent store for entities matching the given criteria.<T> voidsave(T entity) Saves an entity to the persistent store.
-
Constructor Details
-
InMemoryGraphProvider
public InMemoryGraphProvider()
-
-
Method Details
-
getName
Description copied from interface:GraphProviderReturns the unique name of this provider.- Specified by:
getNamein interfaceGraphProvider- Returns:
- the provider name.
-
save
public <T> void save(T entity) Description copied from interface:GraphProviderSaves an entity to the persistent store.- Specified by:
savein interfaceGraphProvider- Type Parameters:
T- the type of the entity- Parameters:
entity- the entity to save
-
load
Description copied from interface:GraphProviderLoads an entity from the persistent store.- Specified by:
loadin interfaceGraphProvider- Type Parameters:
T- the type of the entity- Parameters:
type- the class of the entityid- the unique identifier of the entity- Returns:
- the loaded entity, or
nullif not found
-
delete
public <T> void delete(T entity) Description copied from interface:GraphProviderDeletes an entity from the persistent store.- Specified by:
deletein interfaceGraphProvider- Type Parameters:
T- the type of the entity- Parameters:
entity- the entity to delete
-
query
Description copied from interface:GraphProviderQueries the persistent store for entities matching the given criteria.- Specified by:
queryin interfaceGraphProvider- Type Parameters:
T- the type of the entities- Parameters:
type- the class of the entities to search forquery- symbols or criteria for the search (implementation-specific)- Returns:
- a list of matching entities
-