1 /******************************************************************************* 2 * Copyright (c) 2000, 2005 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.jdt.debug.eval; 12 13 14 import org.eclipse.debug.core.DebugException; 15 import org.eclipse.jdt.core.dom.Message; 16 import org.eclipse.jdt.debug.core.IJavaThread; 17 import org.eclipse.jdt.debug.core.IJavaValue; 18 19 /** 20 * The result of an evaluation. An evaluation result may 21 * contain problems and/or a result value. 22 * <p> 23 * Clients are not intended to implement this interface. 24 * </p> 25 * @see IJavaValue 26 * @since 2.0 27 */ 28 29 public interface IEvaluationResult { 30 31 /** 32 * Returns the value representing the result of the 33 * evaluation, or <code>null</code> if the 34 * associated evaluation failed. If 35 * the associated evaluation failed, there will 36 * be problems, or an exception in this result. 37 * 38 * @return the resulting value, possibly 39 * <code>null</code> 40 */ 41 public IJavaValue getValue(); 42 43 /** 44 * Returns whether the evaluation had any problems 45 * or if an exception occurred while performing the 46 * evaluation. 47 * 48 * @return whether there were any problems. 49 * @see #getErrors() 50 * @see #getException() 51 */ 52 public boolean hasErrors(); 53 54 /** 55 * Returns an array of problem messages. Each message describes a problem that 56 * occurred while compiling the snippet. 57 * 58 * @return compilation error messages, or an empty array if no errors occurred 59 * @deprecated use getErrorMessages() 60 */ 61 public Message[] getErrors(); 62 63 /** 64 * Returns an array of problem messages. Each message describes a problem that 65 * occurred while compiling the snippet. 66 * 67 * @return compilation error messages, or an empty array if no errors occurred 68 * @since 2.1 69 */ 70 public String[] getErrorMessages(); 71 72 /** 73 * Returns the snippet that was evaluated. 74 * 75 * @return The string code snippet. 76 */ 77 public String getSnippet(); 78 79 /** 80 * Returns any exception that occurred while performing the evaluation 81 * or <code>null</code> if an exception did not occur. 82 * The exception will be a debug exception or a debug exception 83 * that wrappers a JDI exception that indicates a problem communicating 84 * with the target or with actually performing some action in the target. 85 * 86 * @return The exception that occurred during the evaluation 87 * @see com.sun.jdi.InvocationException 88 * @see org.eclipse.debug.core.DebugException 89 */ 90 public DebugException getException(); 91 92 /** 93 * Returns the thread in which the evaluation was performed. 94 * 95 * @return the thread in which the evaluation was performed 96 */ 97 public IJavaThread getThread(); 98 99 /** 100 * Returns the evaluation engine used to evaluate the original 101 * snippet. 102 * 103 * @return the evaluation engine used to evaluate the 104 * original snippet 105 */ 106 public IEvaluationEngine getEvaluationEngine(); 107 } 108