AbstractDomainEvent
Superclass for all domain events that are raised by the framework when interacting with actions, properties or collections.
The main purpose of the class is to define the protocol by which subscribers can influence an interaction (eg hide a collection, disable a property, validate action arguments).
The class also provides a simple mechanism to allow adhoc sharing of user data between different phases.
API
class AbstractDomainEvent<S> {
AbstractDomainEvent() (1)
AbstractDomainEvent(S source) (2)
AbstractDomainEvent(S source, Identifier identifier)
S getSource() (3)
void setMixee(Object mixee) (4)
T getSubject() (5)
void setEventPhase(Phase phase) (6)
void setIdentifier(Identifier identifier) (7)
void hide() (8)
void hideIf(boolean condition) (9)
void hideIf(BooleanSupplier shouldHide) (10)
boolean isDisabled()
void disable(String reason) (11)
void disable(TranslatableString reason) (12)
void disableIfReason(Supplier<String> reasonSupplier) (13)
void disableIfTranslatableReason(Supplier<TranslatableString> reasonSupplier) (14)
boolean isInvalid()
void invalidate(String reason) (15)
void invalidate(TranslatableString reason) (16)
void invalidateIfReason(Supplier<String> reasonSupplier) (17)
void invalidateIfTranslatableReason(Supplier<TranslatableString> reasonSupplier) (18)
void veto(String reason, Object... args) (19)
void veto(TranslatableString translatableReason) (20)
Object get(Object key) (21)
void put(Object key, Object value) (22)
String toString()
}
1 | AbstractDomainEvent()
If used then the framework will set state via (non-API) setters. |
2 | AbstractDomainEvent(S)
If used then the framework will set the remaining state via (non-API) setters. |
3 | getSource()
The domain object raising this event. |
4 | setMixee(Object)
Not API - set by the framework. |
5 | getSubject()
The subject of the event, which will be either the #getSource() source for a regular action, or the #getMixee() mixed-in domain object for a mixin. |
6 | setEventPhase(Phase)
Not API, set by the framework. |
7 | setIdentifier(Identifier)
Not API, set by the framework if the no-arg constructor is used. |
8 | hide()
API for subscribers to hide the member. |
9 | hideIf(boolean)
Same as … if(condition) hide(); |
10 | hideIf(BooleanSupplier)
Same as … if(shouldHide.getAsBoolean()) hide(); |
11 | disable(String)
API for subscribers to disable the member, specifying the reason why. |
12 | disable(TranslatableString)
API for subscribers to disable the member, specifying the reason why as a TranslatableString . |
13 | disableIfReason(Supplier)
Same as … if(reasonSupplier.get()!=null) disable(reasonSupplier.get()); |
14 | disableIfTranslatableReason(Supplier)
Same as … if(reasonSupplier.get()!=null) disable(reasonSupplier.get()); |
15 | invalidate(String)
API for subscribers to invalidate an interaction, eg invalid arguments to an action. |
16 | invalidate(TranslatableString)
API for subscribers to invalidate an interaction, specifying the reason as a TranslatableString . |
17 | invalidateIfReason(Supplier)
Same as … if(reasonSupplier.get()!=null) invalidate(reasonSupplier.get()); |
18 | invalidateIfTranslatableReason(Supplier)
Same as … if(reasonSupplier.get()!=null) invalidate(reasonSupplier.get()); |
19 | veto(String, Object)
Use instead of #hide() , #disable(String) and #invalidate(String) ; just delegates to appropriate vetoing method based upon the #getEventPhase() phase . |
20 | veto(TranslatableString)
Use instead of #hide() , #disable(org.apache.causeway.applib.services.i18n.TranslatableString) and #invalidate(org.apache.causeway.applib.services.i18n.TranslatableString) ; just delegates to appropriate vetoing method based upon the #getEventPhase() phase . |
21 | get(Object)
Obtain user-data, as set by a previous #getEventPhase() phase . |
22 | put(Object, Object)
Mechanism to allow subscribers to share arbitrary information between phases. One event instance is used for both the hide and disable phases, and a different event instance is shared between validate/pre-execute/post-execute. Set user-data, for the use of a subsequent #getEventPhase() phase . |
Members
AbstractDomainEvent()
If used then the framework will set state via (non-API) setters.
Because the EventObjectBase superclass prohibits a null source, a dummy value is temporarily used.
AbstractDomainEvent(S)
If used then the framework will set the remaining state via (non-API) setters.
Provided to allow nested non-static implementations, for use in nested non-static mixins.
getSource()
The domain object raising this event.
For a "regular" action, property or collection then this will be the target domain object.
But for a "mixin" action, this will be an instance of the mixin itself.
getSubject()
The subject of the event, which will be either the #getSource() source for a regular action, or the #getMixee() mixed-in domain object for a mixin.
disable(TranslatableString)
API for subscribers to disable the member, specifying the reason why as a TranslatableString .
disableIfTranslatableReason(Supplier)
Same as … if(reasonSupplier.get()!=null) disable(reasonSupplier.get());
invalidate(String)
API for subscribers to invalidate an interaction, eg invalid arguments to an action.
invalidate(TranslatableString)
API for subscribers to invalidate an interaction, specifying the reason as a TranslatableString .
invalidateIfReason(Supplier)
Same as … if(reasonSupplier.get()!=null) invalidate(reasonSupplier.get());
invalidateIfTranslatableReason(Supplier)
Same as … if(reasonSupplier.get()!=null) invalidate(reasonSupplier.get());
veto(String, Object)
Use instead of #hide() , #disable(String) and #invalidate(String) ; just delegates to appropriate vetoing method based upon the #getEventPhase() phase .
If hiding, just pass null
for the parameter.
veto(TranslatableString)
Use instead of #hide() , #disable(org.apache.causeway.applib.services.i18n.TranslatableString) and #invalidate(org.apache.causeway.applib.services.i18n.TranslatableString) ; just delegates to appropriate vetoing method based upon the #getEventPhase() phase .
If hiding, just pass null
for the parameter.
put(Object, Object)
Mechanism to allow subscribers to share arbitrary information between phases. One event instance is used for both the hide and disable phases, and a different event instance is shared between validate/pre-execute/post-execute. Set user-data, for the use of a subsequent #getEventPhase() phase .