KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdi > internal > event > MethodExitEventImpl


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdi.internal.event;
12
13
14 import java.io.DataInputStream JavaDoc;
15 import java.io.IOException JavaDoc;
16
17 import org.eclipse.jdi.internal.MirrorImpl;
18 import org.eclipse.jdi.internal.ValueImpl;
19 import org.eclipse.jdi.internal.VirtualMachineImpl;
20 import org.eclipse.jdi.internal.request.RequestID;
21
22 import com.sun.jdi.Method;
23 import com.sun.jdi.Value;
24 import com.sun.jdi.event.MethodExitEvent;
25
26 /**
27  * this class implements the corresponding interfaces
28  * declared by the JDI specification. See the com.sun.jdi package
29  * for more information.
30  *
31  */

32 public class MethodExitEventImpl extends LocatableEventImpl implements MethodExitEvent {
33     /** Jdwp Event Kind. */
34     public static final byte EVENT_KIND = EVENT_METHOD_EXIT;
35     
36     /** return value for the method **/
37     private Value fReturnValue = null;
38     
39     /**
40      * Creates new MethodExitEventImpl.
41      */

42     private MethodExitEventImpl(VirtualMachineImpl vmImpl, RequestID requestID) {
43         super("MethodExitEvent", vmImpl, requestID); //$NON-NLS-1$
44
}
45         
46     /**
47      * @return Creates, reads and returns new EventImpl, of which requestID has already been read.
48      */

49     public static MethodExitEventImpl read(MirrorImpl target, RequestID requestID, DataInputStream JavaDoc dataInStream) throws IOException JavaDoc {
50         VirtualMachineImpl vmImpl = target.virtualMachineImpl();
51         MethodExitEventImpl event = new MethodExitEventImpl(vmImpl, requestID);
52         event.readThreadAndLocation(target, dataInStream);
53         return event;
54     }
55     
56     /**
57      * @return Creates, reads and returns new EventImpl, of which requestID has already been read.
58      */

59     public static MethodExitEventImpl readWithReturnValue(MirrorImpl target, RequestID requestID, DataInputStream JavaDoc dataInStream) throws IOException JavaDoc {
60         VirtualMachineImpl vmImpl = target.virtualMachineImpl();
61         MethodExitEventImpl event = new MethodExitEventImpl(vmImpl, requestID);
62         event.readThreadAndLocation(target, dataInStream);
63         event.fReturnValue = ValueImpl.readWithTag(target, dataInStream);
64         return event;
65     }
66
67     /**
68      * @return Returns the method that was entered.
69      */

70     public Method method() {
71         return fLocation.method();
72     }
73     
74     /**
75      * @see com.sun.jdi.event.MethodExitEvent#returnValue()
76      * @since 3.3
77      */

78     public Value returnValue() {
79         return fReturnValue;
80     }
81 }
82
Popular Tags