org.apache.ojb.broker
Class PBLifeCycleEvent

java.lang.Object
  extended by java.util.EventObject
      extended by org.apache.ojb.broker.util.event.OjbEvent
          extended by org.apache.ojb.broker.PersistenceBrokerEvent
              extended by org.apache.ojb.broker.PBLifeCycleEvent
All Implemented Interfaces:
java.io.Serializable

public final class PBLifeCycleEvent
extends PersistenceBrokerEvent

The PBLifeCycleEvent encapsulates information about the life-cycle of a persistent object.
NOTE:
Because of performance reasons OJB intern reuse instances of this class by reset target object.

Version:
$Id: PBLifeCycleEvent.java 365231 2005-12-21 22:22:08Z tomdz $
Author:
Armin Waibel
See Also:
Serialized Form

Nested Class Summary
static class PBLifeCycleEvent.Type
          Enum-like class for the event types.
 
Field Summary
static int TYPE_AFTER_DELETE
          Denotes an event that happens after the deletion of an object.
static int TYPE_AFTER_INSERT
          Denotes an event that happens after the insertion of an object.
static int TYPE_AFTER_LOOKUP
          Denotes an event that happens after the lookup of an object.
static int TYPE_AFTER_UPDATE
          Denotes an event that happens after the update of an object.
static int TYPE_BEFORE_DELETE
          Denotes an event that happens before the deletion of an object.
static int TYPE_BEFORE_INSERT
          Denotes an event that happens before the insertion of an object.
static int TYPE_BEFORE_UPDATE
          Denotes an event that happens before the update of an object.
 
Constructor Summary
PBLifeCycleEvent(PersistenceBroker broker, java.lang.Object target, PBLifeCycleEvent.Type eventType)
          Creates a new event instance.
PBLifeCycleEvent(PersistenceBroker broker, PBLifeCycleEvent.Type type)
          Creates a new event instance.
 
Method Summary
 PBLifeCycleEvent.Type getEventType()
          Returns the event type.
 PersistenceBrokerAware getPersitenceBrokerAware()
          Returns the target object as an instance of PersistenceBrokerAware if possible.
 java.lang.Object getTarget()
          Returns the object that caused the event.
 void setTarget(java.lang.Object obj)
          Set the object that caused the event.
 java.lang.String toString()
          
 
Methods inherited from class org.apache.ojb.broker.PersistenceBrokerEvent
getTriggeringBroker
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_BEFORE_INSERT

public static final int TYPE_BEFORE_INSERT
Denotes an event that happens before the insertion of an object.

See Also:
Constant Field Values

TYPE_BEFORE_DELETE

public static final int TYPE_BEFORE_DELETE
Denotes an event that happens before the deletion of an object.

See Also:
Constant Field Values

TYPE_BEFORE_UPDATE

public static final int TYPE_BEFORE_UPDATE
Denotes an event that happens before the update of an object.

See Also:
Constant Field Values

TYPE_AFTER_UPDATE

public static final int TYPE_AFTER_UPDATE
Denotes an event that happens after the update of an object.

See Also:
Constant Field Values

TYPE_AFTER_DELETE

public static final int TYPE_AFTER_DELETE
Denotes an event that happens after the deletion of an object.

See Also:
Constant Field Values

TYPE_AFTER_LOOKUP

public static final int TYPE_AFTER_LOOKUP
Denotes an event that happens after the lookup of an object.

See Also:
Constant Field Values

TYPE_AFTER_INSERT

public static final int TYPE_AFTER_INSERT
Denotes an event that happens after the insertion of an object.

See Also:
Constant Field Values
Constructor Detail

PBLifeCycleEvent

public PBLifeCycleEvent(PersistenceBroker broker,
                        java.lang.Object target,
                        PBLifeCycleEvent.Type eventType)
Creates a new event instance.

Parameters:
broker - The broker
target - The object which caused the event
eventType - The type of the event

PBLifeCycleEvent

public PBLifeCycleEvent(PersistenceBroker broker,
                        PBLifeCycleEvent.Type type)
Creates a new event instance.

Parameters:
broker - The broker
type - The type of the event
Method Detail

getPersitenceBrokerAware

public PersistenceBrokerAware getPersitenceBrokerAware()
Returns the target object as an instance of PersistenceBrokerAware if possible.

Returns:
The PersistenceBrokerAware instance if there is a target and it implements this interface

setTarget

public void setTarget(java.lang.Object obj)
Set the object that caused the event.

Parameters:
obj - The object

getTarget

public java.lang.Object getTarget()
Returns the object that caused the event.

Returns:
The object

toString

public java.lang.String toString()

Overrides:
toString in class java.util.EventObject

getEventType

public PBLifeCycleEvent.Type getEventType()
Returns the event type.

Returns:
The event type


(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30