Class EvaluationResult
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.eval.EvaluationResult
An EvaluationResult is the result of a code snippet evaluation, a global
variable evaluation or it is used to report problems against imports and
package declaration.
It primarily contains the representation of the resulting value (e.g. its
toString() representation). However if the code snippet, a global variable
definition, an import or the package declaration could not be compiled, it
contains the corresponding compilation problems.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The evaluation result contains the value of a code snippet or it reports a problem on a code snippet.static final int
The evaluation result reports a problem on an import declaration.static final int
The evaluation result reports an internal problem.static final int
The evaluation result reports a problem on a package declaration.static final int
The evaluation result contains the value of a variable or it reports a problem on a variable. -
Constructor Summary
ConstructorDescriptionEvaluationResult
(char[] evaluationID, int evaluationType, char[] displayString, char[] typeName) EvaluationResult
(char[] evaluationID, int evaluationType, CategorizedProblem[] problems) -
Method Summary
Modifier and TypeMethodDescriptionchar[]
Returns the ID of the evaluation.int
Returns the type of evaluation this result is about.Returns an array of problems (errors and warnings) encountered during the compilation of a code snippet or a global variable definition, or during the analysis of a package name or an import.getValue()
Returns a proxy object on this result's value.char[]
Returns the displayable representation of this result's value.char[]
Returns the dot-separated fully qualified name of this result's value type.boolean
Returns whether there are errors in the code snippet or the global variable definition.boolean
Returns whether there are problems in the code snippet or the global variable definition.boolean
hasValue()
Returns whether this result has a value.boolean
Returns whether there are warnings in the code snippet or the global variable definition.toString()
Returns a readable representation of this result.
-
Field Details
-
T_VARIABLE
public static final int T_VARIABLEThe evaluation result contains the value of a variable or it reports a problem on a variable. Note that if the problem is on the type of the variable, the source line number is -1. If the problem is on the name of the variable, the source line number is 0. Otherwise the source line number is relative to the initializer code.- See Also:
-
T_CODE_SNIPPET
public static final int T_CODE_SNIPPETThe evaluation result contains the value of a code snippet or it reports a problem on a code snippet.- See Also:
-
T_IMPORT
public static final int T_IMPORTThe evaluation result reports a problem on an import declaration.- See Also:
-
T_PACKAGE
public static final int T_PACKAGEThe evaluation result reports a problem on a package declaration.- See Also:
-
T_INTERNAL
public static final int T_INTERNALThe evaluation result reports an internal problem.- See Also:
-
-
Constructor Details
-
EvaluationResult
public EvaluationResult(char[] evaluationID, int evaluationType, char[] displayString, char[] typeName) -
EvaluationResult
-
-
Method Details
-
getEvaluationID
public char[] getEvaluationID()Returns the ID of the evaluation. If the result is about a global variable, returns the name of the variable. If the result is about a code snippet, returns the code snippet. If the result is about an import, returns the import. If the result is about a package declaration, returns the package declaration. -
getEvaluationType
public int getEvaluationType()Returns the type of evaluation this result is about. This indicates if the result is about a global variable, a code snippet, an import or a package declaration. Use getEvaluationID() to get the object itself. -
getProblems
Returns an array of problems (errors and warnings) encountered during the compilation of a code snippet or a global variable definition, or during the analysis of a package name or an import. Returns an empty array if there are no problems. -
getValue
Returns a proxy object on this result's value. Returns null if the result's value is null. The returned value is undefined if there is no result. The proxy object is expected to answer questions like: - What is the proxy type for this object? - What is the toString() representation for this object? - What are the field names of this object? - What is the value for a given field name? Special proxy objects are expected if the value is a primitive type. -
getValueDisplayString
public char[] getValueDisplayString()Returns the displayable representation of this result's value. This is obtained by sending toString() to the result object on the target side if it is not a primitive value. If it is a primitive value, the corresponding static toString(...) is used, e.g. Integer.toString(int n) if it is an int. Returns null if there is no value. -
getValueTypeName
public char[] getValueTypeName()Returns the dot-separated fully qualified name of this result's value type. If the value is a primitive value, returns the toString() representation of its type (e.g. "int", "boolean", etc.) Returns null if there is no value. -
hasErrors
public boolean hasErrors()Returns whether there are errors in the code snippet or the global variable definition. -
hasProblems
public boolean hasProblems()Returns whether there are problems in the code snippet or the global variable definition. -
hasValue
public boolean hasValue()Returns whether this result has a value. -
hasWarnings
public boolean hasWarnings()Returns whether there are warnings in the code snippet or the global variable definition. -
toString
Returns a readable representation of this result. This is for debugging purpose only.
-