ENTITY
- the entity type@FunctionalInterface public interface Updater<ENTITY> extends UnaryOperator<ENTITY>, Consumer<ENTITY>
UnaryOperator
- and
Consumer
-interfaces so that it can be used inside a Stream
.Modifier and Type | Method and Description |
---|---|
default void |
accept(ENTITY entity)
Updates the entity in the data store.
|
ENTITY |
apply(ENTITY entity)
Updates the provided entity in the underlying database and returns a
potentially updated entity.
|
identity
ENTITY apply(ENTITY entity) throws SpeedmentException
SpeedmentException
is thrown.
It is unspecified if the returned updated entity is the same provided entity instance or another entity instance. It is erroneous to assume either, so you should use only the returned entity after the method has been called. However, it is guaranteed that the provided entity is untouched if an exception is thrown.
The fields of returned entity instance may differ from the provided entity fields due to auto generated column(s) or because of any other modification that the underlying database imposed on the persisted entity.
Entities are uniquely identified by their primary key(s).
apply
in interface Function<ENTITY,ENTITY>
entity
- to updateSpeedmentException
- if the underlying database throws an exception
(e.g. SQLException)default void accept(ENTITY entity)
accept
in interface Consumer<ENTITY>
entity
- the entity to updateSpeedmentException
- if updating the entity failedCopyright © 2019 Speedment, Inc.. All rights reserved.