Module is.codion.framework.model
Package is.codion.framework.model
Interface EntityEditor.EditorEntity
- All Superinterfaces:
Observable<Entity>,Observer<Entity>
- Enclosing interface:
EntityEditor
Provides access to the entity instance being edited.
-
Nested Class Summary
Nested classes/interfaces inherited from interface is.codion.common.reactive.observer.Observer
Observer.Builder<T,B extends Observer.Builder<T, B>> -
Method Summary
Modifier and TypeMethodDescriptionchanging()Throwing aCancelExceptionfrom a listener will cancel the change.get()voidrefresh()Refreshes the active Entity from the database, discarding all changes.voidReplaces the entity without notifying that it is changing.voidPopulates this editor entity with the values from the given entity or sets the default value for all attributes in case it is null.Methods inherited from interface is.codion.common.reactive.observer.Observable
getOrThrow, getOrThrow, is, isNot, isNull, isNullable, optionalMethods inherited from interface is.codion.common.reactive.observer.Observer
addConsumer, addListener, addWeakConsumer, addWeakListener, observer, removeConsumer, removeListener, removeWeakConsumer, removeWeakListener, when, when
-
Method Details
-
get
Entity get()- Specified by:
getin interfaceObservable<Entity>- Returns:
- an immutable copy of the entity being edited
-
set
Populates this editor entity with the values from the given entity or sets the default value for all attributes in case it is null.
Use
EntityEditor.clear()in order to clear the editor of all values.Notifies that the entity is about to change via
changing()- Parameters:
entity- the entity to set, if null, then defaults are set- Throws:
IllegalArgumentException- in case the entity is not of the correct type- See Also:
-
changing
Throwing a
CancelExceptionfrom a listener will cancel the change.- Returns:
- an observer notified each time the entity is about to be changed via
set(Entity)orEntityEditor.defaults(). - See Also:
-
replace
Replaces the entity without notifying that it is changing. -
refresh
void refresh()Refreshes the active Entity from the database, discarding all changes. If the active Entity is new then calling this method has no effect.- See Also:
-