Class AvailabilityChangeEvent<S extends AvailabilityState>
java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
org.springframework.context.PayloadApplicationEvent<S>
org.springframework.boot.availability.AvailabilityChangeEvent<S>
- Type Parameters:
S- the availability state type
- All Implemented Interfaces:
Serializable, org.springframework.core.ResolvableTypeProvider
public 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.
- Since:
- 2.3.0
- See Also:
-
Field Summary
Fields inherited from class EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionAvailabilityChangeEvent(Object source, S state) Create a newAvailabilityChangeEventinstance. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.core.ResolvableTypegetState()Return the changed availability state.static <S extends AvailabilityState>
voidpublish(org.springframework.context.ApplicationContext context, S state) Convenience method that can be used to publish anAvailabilityChangeEventto the given application context.static <S extends AvailabilityState>
voidConvenience method that can be used to publish anAvailabilityChangeEventto the given application context.Methods inherited from class org.springframework.context.PayloadApplicationEvent
getPayloadMethods inherited from class org.springframework.context.ApplicationEvent
getTimestampMethods inherited from class EventObject
getSource, toString
-
Constructor Details
-
AvailabilityChangeEvent
Create a newAvailabilityChangeEventinstance.- Parameters:
source- the source of the eventstate- the availability state (nevernull)
-
-
Method Details
-
getState
-
getResolvableType
public org.springframework.core.ResolvableType getResolvableType()- Specified by:
getResolvableTypein interfaceorg.springframework.core.ResolvableTypeProvider- Overrides:
getResolvableTypein classorg.springframework.context.PayloadApplicationEvent<S extends AvailabilityState>
-
publish
public static <S extends AvailabilityState> void publish(org.springframework.context.ApplicationContext context, S state) Convenience method that can be used to publish anAvailabilityChangeEventto the given application context.- Type Parameters:
S- the availability state type- Parameters:
context- the context used to publish the eventstate- the changed availability state
-
publish
public static <S extends AvailabilityState> void publish(org.springframework.context.ApplicationEventPublisher publisher, Object source, S state) Convenience method that can be used to publish anAvailabilityChangeEventto the given application context.- Type Parameters:
S- the availability state type- Parameters:
publisher- the publisher used to publish the eventsource- the source of the eventstate- the changed availability state
-