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:
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,v 1.1 2007-08-24 22:17:36 ewestfal Exp $
Author:
Armin Waibel
See Also:
Serialized Form

Nested Class Summary
static class PBLifeCycleEvent.Type
          Enum-like class for the event types.
 
Field Summary
private  PBLifeCycleEvent.Type eventType
           
private  Object target
           
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.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
PBLifeCycleEvent(PersistenceBroker broker, 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.
 Object getTarget()
          Returns the object that caused the event.
 void setTarget(Object obj)
          Set the object that caused the event.
 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
clone, equals, finalize, 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

eventType

private PBLifeCycleEvent.Type eventType

target

private Object target
Constructor Detail

PBLifeCycleEvent

public PBLifeCycleEvent(PersistenceBroker broker,
                        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(Object obj)
Set the object that caused the event.

Parameters:
obj - The object

getTarget

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

Returns:
The object

toString

public String toString()

Overrides:
toString in class EventObject

getEventType

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

Returns:
The event type


Copyright © 2007-2011 The Kuali Foundation. All Rights Reserved.