Package org.libvirt.event
Class DomainEvent
java.lang.Object
org.libvirt.event.DomainEvent
Contains information about a life cycle change of a domain.
This includes the domain event that occurred together with further details about that event.
Usage:
int onLifecycleChange(Domain dom, DomainEvent info) {
switch (info.getType()) {
case STARTED:
StartedDetail detail = info.getDetail();
switch (detail) {
case BOOTED:
...
break;
...
}
}
}
}
Note, that a ClassCastException will be thrown at runtime when assigning to the wrong detail enumeration type:
DomainEvent info;
if (info.getType() == DomainEventType.STARTED) {
// info.getDetails() returns a StartedDetail enum
StoppedDetail detail = info.getDetail(); // throws ClassCastException
}
- Since:
- 1.5.2
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T extends Enum<T> & DomainEventDetail>
TReturns the corresponding domain event detail in regard to the DomainEventType of this instance.getType()
Returns the type of event which occurred.toString()
-
Constructor Details
-
DomainEvent
-
-
Method Details
-
getType
Returns the type of event which occurred. -
getDetail
Returns the corresponding domain event detail in regard to the DomainEventType of this instance.- Returns:
- a constant of one of the enums implementing the
DomainEventDetail
interface
-
toString
-