javax.jdo.listener

## Class InstanceLifecycleEvent

- java.lang.Object
- - java.util.EventObject
  - - javax.jdo.listener.InstanceLifecycleEvent

- All Implemented Interfaces:
    Serializable

      public class InstanceLifecycleEvent
      extends EventObject

  This 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 and Description
    --- | ---
    `static int` | `ATTACH`
    `static int` | `CLEAR`
    `static int` | `CREATE`
    `static int` | `DELETE`
    `static int` | `DETACH`
    `static int` | `DIRTY`
    `static int` | `LOAD`
    `static int` | `STORE`

    - ### Fields inherited from class java.util.EventObject

      `source`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InstanceLifecycleEvent(Object source, int type)` Creates a new event object with the specified `source` and `type`.
    `InstanceLifecycleEvent(Object source, int type, Object target)` Creates a new event object with the specified `source`, `type`, and `target`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `getDetachedInstance()` Returns the detached instance involved in the event.
    `int` | `getEventType()` Returns the event type that triggered this event.
    `Object` | `getPersistentInstance()` Returns the persistent instance involved in the event.
    `Object` | `getSource()` The source object of the Event.
    `Object` | `getTarget()` The target object of the Event.

    - ### Methods inherited from class java.util.EventObject

      `toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### 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

  - ### Constructor Detail

    - #### InstanceLifecycleEvent

          public InstanceLifecycleEvent(Object source,
                                        int type)

      Creates a new event object with the specified `source` and `type`.
      Parameters:
        `source` - the instance that triggered the event
        `type` - the event type
      Since:
        2.0

    - #### InstanceLifecycleEvent

          public InstanceLifecycleEvent(Object source,
                                        int type,
                                        Object target)

      Creates a new event object with the specified `source`, `type`, and `target`.
      Parameters:
        `source` - the instance that triggered the event
        `type` - the event type
        `target` - 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 Object getSource()

      The source object of the Event. Although not deprecated, it is recommended that the the methods `getPersistentInstance()` and `getDetachedInstance()` be used instead.
      Overrides:
        `getSource` in class `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 Object getTarget()

      The target object of the Event. Although not deprecated, it is recommended that the the methods `getPersistentInstance()` and `getDetachedInstance()` 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 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 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"

Copyright © 2005–2022 The Apache Software Foundation. All rights reserved.