S
- the availability state typepublic class AvailabilityChangeEvent<S extends AvailabilityState>
extends org.springframework.context.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.
Constructor and Description |
---|
AvailabilityChangeEvent(java.lang.Object source,
S state)
Create a new
AvailabilityChangeEvent instance. |
Modifier and Type | Method and Description |
---|---|
org.springframework.core.ResolvableType |
getResolvableType() |
S |
getState()
Return the changed availability state.
|
static <S extends AvailabilityState> |
publish(org.springframework.context.ApplicationContext context,
S state)
Convenience method that can be used to publish an
AvailabilityChangeEvent
to the given application context. |
static <S extends AvailabilityState> |
publish(org.springframework.context.ApplicationEventPublisher publisher,
java.lang.Object source,
S state)
Convenience method that can be used to publish an
AvailabilityChangeEvent
to the given application context. |
public AvailabilityChangeEvent(java.lang.Object source, S state)
AvailabilityChangeEvent
instance.source
- the source of the eventstate
- the availability state (never null
)public S getState()
public org.springframework.core.ResolvableType getResolvableType()
getResolvableType
in interface org.springframework.core.ResolvableTypeProvider
getResolvableType
in class org.springframework.context.PayloadApplicationEvent<S extends AvailabilityState>
public static <S extends AvailabilityState> void publish(org.springframework.context.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(org.springframework.context.ApplicationEventPublisher publisher, java.lang.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