01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdi.internal.event;
11:
12: import java.io.DataInputStream;
13: import java.io.IOException;
14:
15: import org.eclipse.jdi.internal.MirrorImpl;
16: import org.eclipse.jdi.internal.ValueImpl;
17: import org.eclipse.jdi.internal.VirtualMachineImpl;
18: import org.eclipse.jdi.internal.request.RequestID;
19:
20: import com.sun.jdi.Method;
21: import com.sun.jdi.Value;
22: import com.sun.jdi.event.MethodExitEvent;
23:
24: /**
25: * this class implements the corresponding interfaces
26: * declared by the JDI specification. See the com.sun.jdi package
27: * for more information.
28: *
29: */
30: public class MethodExitEventImpl extends LocatableEventImpl implements
31: MethodExitEvent {
32: /** Jdwp Event Kind. */
33: public static final byte EVENT_KIND = EVENT_METHOD_EXIT;
34:
35: /** return value for the method **/
36: private Value fReturnValue = null;
37:
38: /**
39: * Creates new MethodExitEventImpl.
40: */
41: private MethodExitEventImpl(VirtualMachineImpl vmImpl,
42: 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,
50: RequestID requestID, DataInputStream dataInStream)
51: throws IOException {
52: VirtualMachineImpl vmImpl = target.virtualMachineImpl();
53: MethodExitEventImpl event = new MethodExitEventImpl(vmImpl,
54: requestID);
55: event.readThreadAndLocation(target, dataInStream);
56: return event;
57: }
58:
59: /**
60: * @return Creates, reads and returns new EventImpl, of which requestID has already been read.
61: */
62: public static MethodExitEventImpl readWithReturnValue(
63: MirrorImpl target, RequestID requestID,
64: DataInputStream dataInStream) throws IOException {
65: VirtualMachineImpl vmImpl = target.virtualMachineImpl();
66: MethodExitEventImpl event = new MethodExitEventImpl(vmImpl,
67: requestID);
68: event.readThreadAndLocation(target, dataInStream);
69: event.fReturnValue = ValueImpl
70: .readWithTag(target, dataInStream);
71: return event;
72: }
73:
74: /**
75: * @return Returns the method that was entered.
76: */
77: public Method method() {
78: return fLocation.method();
79: }
80:
81: /**
82: * @see com.sun.jdi.event.MethodExitEvent#returnValue()
83: * @since 3.3
84: */
85: public Value returnValue() {
86: return fReturnValue;
87: }
88: }
|