Package step.core.accessors
Class CachedAccessor<T extends step.core.accessors.AbstractIdentifiableObject>
- java.lang.Object
-
- step.core.accessors.CachedAccessor<T>
-
-
Constructor Summary
Constructors Constructor Description CachedAccessor(Accessor<T> underlyingAccessor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TfindByAttributes(Map<String,String> attributes)Find an object by default attributes.TfindByAttributes(Map<String,String> attributes, String attributesMapKey)Find an object by attributes.TfindByCriteria(Map<String,String> criteria)Find an object by criteria.Spliterator<T>findManyByAttributes(Map<String,String> attributes)Find objects by attributes.Spliterator<T>findManyByAttributes(Map<String,String> attributes, String attributesMapKey)Find objects by attributes.Stream<T>findManyByCriteria(Map<String,String> criteria)Find objects by criteria.Tget(String id)Get an object by idTget(org.bson.types.ObjectId id)Get an object by idIterator<T>getAll()List<T>getRange(int skip, int limit)Get the range of objects specified by the skip/limit parameters browsing the collection sorted by ID in the descending ordervoidreloadCache()Reloads all the entities from the underlyingAccessorvoidremove(org.bson.types.ObjectId id)Remove an entity.voidsave(Iterable<T> entities)Save a list of entities.Tsave(T entity)Save an entity.Stream<T>stream()
-
-
-
Method Detail
-
reloadCache
public void reloadCache()
Reloads all the entities from the underlyingAccessor
-
get
public T get(org.bson.types.ObjectId id)
Description copied from interface:AccessorGet an object by id
-
findByCriteria
public T findByCriteria(Map<String,String> criteria)
Description copied from interface:AccessorFind an object by criteria. If multiple objects match these criteria, the first one will be returned- Specified by:
findByCriteriain interfaceAccessor<T extends step.core.accessors.AbstractIdentifiableObject>- Parameters:
criteria- the map of mandatory criteria of the object to be found- Returns:
- the object
-
findManyByCriteria
public Stream<T> findManyByCriteria(Map<String,String> criteria)
Description copied from interface:AccessorFind objects by criteria.- Specified by:
findManyByCriteriain interfaceAccessor<T extends step.core.accessors.AbstractIdentifiableObject>- Parameters:
criteria- the map of mandatory criteria of the object to be found- Returns:
- an
Iteratorfor the objects found
-
findByAttributes
public T findByAttributes(Map<String,String> attributes)
Description copied from interface:AccessorFind an object by default attributes. If multiple objects match these attributes, the first one will be returned- Specified by:
findByAttributesin interfaceAccessor<T extends step.core.accessors.AbstractIdentifiableObject>- Parameters:
attributes- the map of mandatory attributes of the object to be found- Returns:
- the object
-
findManyByAttributes
public Spliterator<T> findManyByAttributes(Map<String,String> attributes)
Description copied from interface:AccessorFind objects by attributes.- Specified by:
findManyByAttributesin interfaceAccessor<T extends step.core.accessors.AbstractIdentifiableObject>- Parameters:
attributes- the map of mandatory attributes of the object to be found- Returns:
- an
Iteratorfor the objects found
-
findByAttributes
public T findByAttributes(Map<String,String> attributes, String attributesMapKey)
Description copied from interface:AccessorFind an object by attributes. If multiple objects match these attributes, the first one will be returned- Specified by:
findByAttributesin interfaceAccessor<T extends step.core.accessors.AbstractIdentifiableObject>- Parameters:
attributes- the map of mandatory attributes of the object to be foundattributesMapKey- the string representing the name (or "key") of the attribute map- Returns:
- the object
-
findManyByAttributes
public Spliterator<T> findManyByAttributes(Map<String,String> attributes, String attributesMapKey)
Description copied from interface:AccessorFind objects by attributes.- Specified by:
findManyByAttributesin interfaceAccessor<T extends step.core.accessors.AbstractIdentifiableObject>- Parameters:
attributes- the map of mandatory attributes of the object to be foundattributesMapKey- the string representing the name (or "key") of the attribute map- Returns:
- an
Iteratorfor the objects found
-
remove
public void remove(org.bson.types.ObjectId id)
Description copied from interface:AccessorRemove an entity.
-
save
public T save(T entity)
Description copied from interface:AccessorSave an entity. If an entity with the same id exists, it will be updated otherwise inserted.
-
save
public void save(Iterable<T> entities)
Description copied from interface:AccessorSave a list of entities.
-
getRange
public List<T> getRange(int skip, int limit)
Description copied from interface:AccessorGet the range of objects specified by the skip/limit parameters browsing the collection sorted by ID in the descending order
-
-