Package step.core.accessors
Class LayeredAccessor<T extends step.core.accessors.AbstractIdentifiableObject>
- java.lang.Object
-
- step.core.accessors.LayeredAccessor<T>
-
-
Constructor Summary
Constructors Constructor Description LayeredAccessor()LayeredAccessor(List<? extends Accessor<T>> accessors)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAccessor(Accessor<T> accessor)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 idprotected Accessor<T>getAccessorForPersistence()Iterator<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 orderprotected <V> VlayeredLookup(Function<Accessor<T>,V> f)protected <V> Spliterator<V>layeredMerge(Function<Accessor<T>,Spliterator<V>> f)protected <V> Stream<V>layeredStreamMerge(Function<Accessor<T>,Stream<V>> f)voidpushAccessor(Accessor<T> accessor)voidremove(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
-
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
-
layeredMerge
protected <V> Spliterator<V> layeredMerge(Function<Accessor<T>,Spliterator<V>> f)
-
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
-
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
-
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.
-
-