Interface ManagedEntity<ID,E>
- Type Parameters:
ID- The type of identifier of the entity.E- The type of the entity.
public interface ManagedEntity<ID,E>
A wrapper around an entity whose lifecycle is being managed by an
Repository.- Since:
- 5.0.0
- Author:
- Allard Buijze
-
Method Summary
Modifier and TypeMethodDescriptionapplyStateChange(UnaryOperator<E> change) Change the current state of the entity using the given {code change} function.@Nullable Eentity()The current state of the entity,nullwhen nothing was loaded from the repository.The identifier of the entity.
-
Method Details
-
identifier
ID identifier()The identifier of the entity.- Returns:
- The identifier of the entity.
-
entity
@Nullable E entity()The current state of the entity,nullwhen nothing was loaded from the repository.- Returns:
- the current state of the entity
-
applyStateChange
Change the current state of the entity using the given {code change} function.- Parameters:
change- The function applying the requested change.- Returns:
- The state of the entity after the change.
-