Package org.oddjob.state
Class StateEvent
java.lang.Object
org.oddjob.state.StateEvent
An instance of this class is produced when a job state changes. It is
passed to all JobStateListeners.
- Author:
- Rob Gordon
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionStateEvent(Stateful job, State jobState) Deprecated, for removal: This API element is subject to removal in a future version.StateEvent(Stateful job, State jobState, Throwable exception) Deprecated, for removal: This API element is subject to removal in a future version.StateEvent(Stateful source, State state, Date time, Throwable exception) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionstatic StateEventatInstant(Stateful source, State state, StateInstant instant) Create a new State Event at the given instant.copy()Create a mutable copy of the event.booleanstatic StateEventexceptionAtInstant(Stateful source, State exceptionState, StateInstant instant, Throwable exception) Create a new State Event at the given instant with the given Exception.static StateEventexceptionNow(Stateful source, State exceptionState, Throwable exception) Create a new State Event with an instant of now and the given Exception.static StateEventfromDetail(Stateful source, StateDetail stateDetail) Create a new State Event with the given source and the other details taken from the State Detail.Get the exception if applicable, null otherwise.Get the time of the event as an instant.getState()Get the job state.Get the time of the event as a State Instant.getTime()Deprecated, for removal: This API element is subject to removal in a future version.inthashCode()static StateEventCreate a new State Event with an instant of now.Provide something that can be serialised.toString()Override toString.
-
Field Details
-
REPLACEMENT_EXCEPTION_TEXT
- See Also:
-
-
Constructor Details
-
StateEvent
@Deprecated(since="1.7", forRemoval=true) public StateEvent(Stateful source, State state, Date time, Throwable exception) Deprecated, for removal: This API element is subject to removal in a future version.Constructor. Deprecated - useexceptionAtInstant(Stateful, State, StateInstant, Throwable)- Parameters:
source- The source of the event.state- The state.time- the Time of the event.exception- The exception if applicable, or null otherwise.
-
StateEvent
@Deprecated(since="1.7", forRemoval=true) public StateEvent(Stateful job, State jobState, Throwable exception) Deprecated, for removal: This API element is subject to removal in a future version.Constructor. Deprecated - useexceptionNow(Stateful, State, Throwable)- Parameters:
job- The source of the event.jobState- The state.exception- The exception if applicable, or null otherwise.
-
StateEvent
Deprecated, for removal: This API element is subject to removal in a future version.Constructor. Deprecated -now(Stateful, State)- Parameters:
job- The source of the event.jobState- The state.
-
-
Method Details
-
atInstant
Create a new State Event at the given instant.- Parameters:
source- The source of the event.state- The state.instant- The date time of the event.- Returns:
- A new State Event.
-
now
Create a new State Event with an instant of now.- Parameters:
source- The source of the event.state- The state.- Returns:
- A new State Event.
-
exceptionAtInstant
public static StateEvent exceptionAtInstant(Stateful source, State exceptionState, StateInstant instant, Throwable exception) Create a new State Event at the given instant with the given Exception. The state is expected to have} true, but this isn't validated.invalid @link
{@link @State#isException- Parameters:
source- The source of the event.exceptionState- The state.instant- The date time of the event.exception-- Returns:
- A new State Event.
-
exceptionNow
Create a new State Event with an instant of now and the given Exception. The state is expected to have} true, but this isn't validated.invalid @link
{@link @State#isException- Parameters:
source- The source of the event.exceptionState- The state.exception-- Returns:
- A new State Event.
-
fromDetail
Create a new State Event with the given source and the other details taken from the State Detail.- Parameters:
source- The source of the event.stateDetail- Provide the other details of the event.- Returns:
- A new State Event.
-
copy
Create a mutable copy of the event.- Returns:
- A mutable copy.
-
getSource
-
getState
Get the job state.- Returns:
- The job state.
-
getException
Get the exception if applicable, null otherwise.- Returns:
- The exception of null.
-
getTime
Deprecated, for removal: This API element is subject to removal in a future version.Get the time of the event. Deprecated - usedgetInstant().- Returns:
- The time.
-
getInstant
Get the time of the event as an instant.- Returns:
- The time.
-
getStateInstant
Get the time of the event as a State Instant.- Returns:
- The State Instant.
-
serializable
Provide something that can be serialised. Note that we do not usewriteReplacebecause there would need to be the correspondingreadResolve- Returns:
- A serializable version of the event without the source.
-
equals
-
hashCode
public int hashCode() -
toString
Override toString.
-