Package javax.jdo.listener
Class InstanceLifecycleEvent
- java.lang.Object
-
- java.util.EventObject
-
- javax.jdo.listener.InstanceLifecycleEvent
-
- All Implemented Interfaces:
java.io.Serializable
public class InstanceLifecycleEvent extends java.util.EventObjectThis is the event class used in life cycle event notifications.Note that although InstanceLifecycleEvent inherits Serializable interface from EventObject, it is not intended to be Serializable. Appropriate serialization methods are implemented to throw NotSerializableException.
- Since:
- 2.0
- Version:
- 2.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intATTACHstatic intCLEARstatic intCREATEstatic intDELETEstatic intDETACHstatic intDIRTYprivate inteventTypeThe event type that triggered the construction of this event object.private static intFIRST_EVENT_TYPEprivate static intLAST_EVENT_TYPEstatic intLOADprivate static I18NHelpermsgThe Internationalization message helper.static intSTOREprivate java.lang.ObjecttargetThe "other" object associated with the event.
-
Constructor Summary
Constructors Constructor Description InstanceLifecycleEvent(java.lang.Object source, int type)Creates a new event object with the specifiedsourceandtype.InstanceLifecycleEvent(java.lang.Object source, int type, java.lang.Object target)Creates a new event object with the specifiedsource,type, andtarget.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectgetDetachedInstance()Returns the detached instance involved in the event.intgetEventType()Returns the event type that triggered this event.java.lang.ObjectgetPersistentInstance()Returns the persistent instance involved in the event.java.lang.ObjectgetSource()The source object of the Event.java.lang.ObjectgetTarget()The target object of the Event.private voidwriteObject(java.io.ObjectOutputStream out)Serialization is not supported for InstanceLifecycleEvents.
-
-
-
Field Detail
-
FIRST_EVENT_TYPE
private static final int FIRST_EVENT_TYPE
- See Also:
- Constant Field Values
-
CREATE
public static final int CREATE
- See Also:
- Constant Field Values
-
LOAD
public static final int LOAD
- See Also:
- Constant Field Values
-
STORE
public static final int STORE
- See Also:
- Constant Field Values
-
CLEAR
public static final int CLEAR
- See Also:
- Constant Field Values
-
DELETE
public static final int DELETE
- See Also:
- Constant Field Values
-
DIRTY
public static final int DIRTY
- See Also:
- Constant Field Values
-
DETACH
public static final int DETACH
- See Also:
- Constant Field Values
-
ATTACH
public static final int ATTACH
- See Also:
- Constant Field Values
-
LAST_EVENT_TYPE
private static final int LAST_EVENT_TYPE
- See Also:
- Constant Field Values
-
msg
private static final I18NHelper msg
The Internationalization message helper.
-
eventType
private final int eventType
The event type that triggered the construction of this event object.
-
target
private final java.lang.Object target
The "other" object associated with the event.
-
-
Constructor Detail
-
InstanceLifecycleEvent
public InstanceLifecycleEvent(java.lang.Object source, int type)Creates a new event object with the specifiedsourceandtype.- Parameters:
source- the instance that triggered the eventtype- the event type- Since:
- 2.0
-
InstanceLifecycleEvent
public InstanceLifecycleEvent(java.lang.Object source, int type, java.lang.Object target)Creates a new event object with the specifiedsource,type, andtarget.- Parameters:
source- the instance that triggered the eventtype- the event typetarget- the "other" instance- Since:
- 2.0
-
-
Method Detail
-
getEventType
public int getEventType()
Returns the event type that triggered this event.- Returns:
- the event type
- Since:
- 2.0
-
getSource
public java.lang.Object getSource()
The source object of the Event. Although not deprecated, it is recommended that the the methodsgetPersistentInstance()andgetDetachedInstance()be used instead.- Overrides:
getSourcein classjava.util.EventObject- Returns:
- The persistent instance on any pre- callback except preAttach, or the detached instance for a postDetach or preAttach callback.
- See Also:
getPersistentInstance(),getDetachedInstance(), "Section 12.15, Java Data Objects 2.0 Specification"
-
getTarget
public java.lang.Object getTarget()
The target object of the Event. Although not deprecated, it is recommended that the the methodsgetPersistentInstance()andgetDetachedInstance()be used instead.- Returns:
- The detached instance for preDetach and postAttach, the persistent instance otherwise.
- Since:
- 2.0
- See Also:
getPersistentInstance(),getDetachedInstance(), "Section 12.15, Java Data Objects 2.0 Specification"
-
getPersistentInstance
public java.lang.Object getPersistentInstance()
Returns the persistent instance involved in the event.- Returns:
- The persistent instance involved in the event, or null if there was none.
- See Also:
- "Section 12.15, Java Data Objects 2.0 Specification"
-
getDetachedInstance
public java.lang.Object getDetachedInstance()
Returns the detached instance involved in the event.- Returns:
- The detached instance involved in the event, or null if there was none.
- See Also:
- "Section 12.15, Java Data Objects 2.0 Specification"
-
writeObject
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOExceptionSerialization is not supported for InstanceLifecycleEvents. param out the output stream- Throws:
java.io.IOException- Since:
- 2.0
-
-