S
- the availability state typepublic class AvailabilityChangeEvent<S extends AvailabilityState> extends PayloadApplicationEvent<S>
ApplicationEvent
sent when the AvailabilityState
of the application
changes.
Any application component can send such events to update the state of the application.
source
Constructor and Description |
---|
AvailabilityChangeEvent(Object source,
S state)
Create a new
AvailabilityChangeEvent instance. |
Modifier and Type | Method and Description |
---|---|
ResolvableType |
getResolvableType() |
S |
getState()
Return the changed availability state.
|
static <S extends AvailabilityState> |
publish(ApplicationContext context,
S state)
Convenience method that can be used to publish an
AvailabilityChangeEvent
to the given application context. |
static <S extends AvailabilityState> |
publish(ApplicationEventPublisher publisher,
Object source,
S state)
Convenience method that can be used to publish an
AvailabilityChangeEvent
to the given application context. |
getPayload
getTimestamp
getSource, toString
public AvailabilityChangeEvent(Object source, S state)
AvailabilityChangeEvent
instance.source
- the source of the eventstate
- the availability state (never null
)public S getState()
public ResolvableType getResolvableType()
getResolvableType
in interface ResolvableTypeProvider
getResolvableType
in class PayloadApplicationEvent<S extends AvailabilityState>
public static <S extends AvailabilityState> void publish(ApplicationContext context, S state)
AvailabilityChangeEvent
to the given application context.S
- the availability state typecontext
- the context used to publish the eventstate
- the changed availability statepublic static <S extends AvailabilityState> void publish(ApplicationEventPublisher publisher, Object source, S state)
AvailabilityChangeEvent
to the given application context.S
- the availability state typepublisher
- the publisher used to publish the eventsource
- the source of the eventstate
- the changed availability state