类 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>
- 类型参数:
S- the availability state type
- 所有已实现的接口:
Serializable,ResolvableTypeProvider
public 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.
- 从以下版本开始:
- 2.3.0
- 作者:
- Brian Clozel, Phillip Webb
- 另请参阅:
-
字段概要
从类继承的字段 java.util.EventObject
source -
构造器概要
构造器构造器说明AvailabilityChangeEvent(Object source, S state) Create a newAvailabilityChangeEventinstance. -
方法概要
修饰符和类型方法说明getState()Return the changed availability state.static <S extends AvailabilityState>
voidpublish(ApplicationContext context, S state) Convenience method that can be used to publish anAvailabilityChangeEventto the given application context.static <S extends AvailabilityState>
voidpublish(ApplicationEventPublisher publisher, Object source, S state) Convenience method that can be used to publish anAvailabilityChangeEventto the given application context.从类继承的方法 org.springframework.context.PayloadApplicationEvent
getPayload从类继承的方法 org.springframework.context.ApplicationEvent
getTimestamp从类继承的方法 java.util.EventObject
getSource, toString
-
构造器详细资料
-
AvailabilityChangeEvent
Create a newAvailabilityChangeEventinstance.- 参数:
source- the source of the eventstate- the availability state (nevernull)
-
-
方法详细资料
-
getState
Return the changed availability state.- 返回:
- the availability state
-
getResolvableType
- 指定者:
getResolvableType在接口中ResolvableTypeProvider- 覆盖:
getResolvableType在类中PayloadApplicationEvent<S extends AvailabilityState>
-
publish
Convenience method that can be used to publish anAvailabilityChangeEventto the given application context.- 类型参数:
S- the availability state type- 参数:
context- the context used to publish the eventstate- the changed availability state
-
publish
public static <S extends AvailabilityState> void publish(ApplicationEventPublisher publisher, Object source, S state) Convenience method that can be used to publish anAvailabilityChangeEventto the given application context.- 类型参数:
S- the availability state type- 参数:
publisher- the publisher used to publish the eventsource- the source of the eventstate- the changed availability state
-