Package org.springframework.context
Class PayloadApplicationEvent<T>
java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
org.springframework.context.PayloadApplicationEvent<T>
- Type Parameters:
T
- the payload type of the event
- All Implemented Interfaces:
Serializable
,ResolvableTypeProvider
An
ApplicationEvent
that carries an arbitrary payload.- Since:
- 4.2
- Author:
- Stephane Nicoll, Juergen Hoeller, Qimiao Chen
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorDescriptionPayloadApplicationEvent
(Object source, T payload) Create a new PayloadApplicationEvent, using the instance to infer its type.PayloadApplicationEvent
(Object source, T payload, ResolvableType payloadType) Create a new PayloadApplicationEvent based on the provided payload type. -
Method Summary
Modifier and TypeMethodDescriptionReturn the payload of the event.Return theResolvableType
describing this instance (ornull
if some sort of default should be applied instead).Methods inherited from class org.springframework.context.ApplicationEvent
getTimestamp
Methods inherited from class java.util.EventObject
getSource, toString
-
Constructor Details
-
PayloadApplicationEvent
Create a new PayloadApplicationEvent, using the instance to infer its type.- Parameters:
source
- the object on which the event initially occurred (nevernull
)payload
- the payload object (nevernull
)
-
PayloadApplicationEvent
Create a new PayloadApplicationEvent based on the provided payload type.- Parameters:
source
- the object on which the event initially occurred (nevernull
)payload
- the payload object (nevernull
)payloadType
- the type object of payload object (can benull
). Note that this is meant to indicate the payload type (e.g.String
), not the full event type (such asPayloadApplicationEvent<<String>
).- Since:
- 6.0
-
-
Method Details
-
getResolvableType
Description copied from interface:ResolvableTypeProvider
Return theResolvableType
describing this instance (ornull
if some sort of default should be applied instead).- Specified by:
getResolvableType
in interfaceResolvableTypeProvider
-
getPayload
Return the payload of the event.
-