站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 4.1.0

InstanceEvent (NetBeans MDR API) - NetBeans API Javadoc 4.1.0

 

org.netbeans.api.mdr.events
Class InstanceEvent

java.lang.Object
  extended byjava.util.EventObject
      extended byorg.netbeans.api.mdr.events.MDRChangeEvent
          extended byorg.netbeans.api.mdr.events.InstanceEvent
All Implemented Interfaces:
Serializable

public class InstanceEvent
extends MDRChangeEvent

MDR Event used for representing events related to lifecycle of class instances (creation and deletion of instances). As this event contains attribute pointing to the affected (created/deleted) instance, it will need to be subclassed in repository implementation. This is because each implementation has to send the same event object to both pre-change and change events. In case of the instance create event, the actual instance is not known by the time the pre-change event is fired (so the event object is created providing null for this attribute), however the created instance has to be referenced from the event object passed to the change event. As the implementation is not allow to send a different instance of event object to the change event, it needs to be able to set the instance property of the original event object. For this purpose a subclass of this event object containing a package protected setter for the instance attribute should be used. Note that for this purpose the instance property is defined as protected instead of private final.

See Also:
Serialized Form

Field Summary
static int EVENT_INSTANCE_CREATE
          Identifier for event type that indicates creation of a new instance of a class.
static int EVENT_INSTANCE_DELETE
          Identifier for event type that indicates an instance of a class is to be/was deleted.
static int EVENTMASK_INSTANCE
          Bitmask representing all the events related to instance lifecycle.
protected  javax.jmi.reflect.RefObject instance
           
 
Fields inherited from class org.netbeans.api.mdr.events.MDRChangeEvent
EVENTMASK_ALL, EVENTMASK_ON_ASSOCIATION, EVENTMASK_ON_CLASS, EVENTMASK_ON_INSTANCE, EVENTMASK_ON_PACKAGE, EVENTMASK_ON_REPOSITORY
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
InstanceEvent(javax.jmi.reflect.RefFeatured source, int type, List arguments, javax.jmi.reflect.RefObject instance)
          Creates new InstanceEvent object.
 
Method Summary
 List getArguments()
          Returns list of initial values for instance attributes (only applicable for instance creation - otherwise null).
 javax.jmi.reflect.RefObject getInstance()
          Returns the created/deleted instance.
 
Methods inherited from class org.netbeans.api.mdr.events.MDRChangeEvent
getType, isOfType
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EVENTMASK_INSTANCE

public static final int EVENTMASK_INSTANCE
Bitmask representing all the events related to instance lifecycle.

See Also:
Constant Field Values

EVENT_INSTANCE_CREATE

public static final int EVENT_INSTANCE_CREATE
Identifier for event type that indicates creation of a new instance of a class.

See Also:
Constant Field Values

EVENT_INSTANCE_DELETE

public static final int EVENT_INSTANCE_DELETE
Identifier for event type that indicates an instance of a class is to be/was deleted.

See Also:
Constant Field Values

instance

protected javax.jmi.reflect.RefObject instance
Constructor Detail

InstanceEvent

public InstanceEvent(javax.jmi.reflect.RefFeatured source,
                     int type,
                     List arguments,
                     javax.jmi.reflect.RefObject instance)
Creates new InstanceEvent object.

Parameters:
source - Event source (class proxy in case of instance creation, instance in case of instance deletion).
type - Event type.
arguments - Immutable list of initial attribute values of the new instance (null in case of instance deletion).
instance - The created/deleted instance or null (in case of pre-change event indicating instance creation).
Method Detail

getArguments

public List getArguments()
Returns list of initial values for instance attributes (only applicable for instance creation - otherwise null).

Returns:
List of initial attribute values.

getInstance

public javax.jmi.reflect.RefObject getInstance()
Returns the created/deleted instance.

Returns:
Created/deleted instance.

 

Built on May 4 2005.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.