Eclipse JDT
2.1

org.eclipse.jdt.core
Class JavaModelException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--org.eclipse.core.runtime.CoreException
                    |
                    +--org.eclipse.jdt.core.JavaModelException
All Implemented Interfaces:
Serializable

public class JavaModelException
extends CoreException

A checked exception representing a failure in the Java model. Java model exceptions contain a Java-specific status object describing the cause of the exception.

This class is not intended to be subclassed by clients. Instances of this class are automatically created by the Java model when problems arise, so there is generally no need for clients to create instances.

See Also:
IJavaModelStatus, IJavaModelStatusConstants, Serialized Form

Constructor Summary
JavaModelException(CoreException exception)
          Creates a Java model exception for the given CoreException.
JavaModelException(IJavaModelStatus status)
          Creates a Java model exception for the given Java-specific status object.
JavaModelException(Throwable e, int code)
          Creates a Java model exception that wrappers the given Throwable.
 
Method Summary
 Throwable getException()
          Returns the underlying Throwable that caused the failure.
 IJavaModelStatus getJavaModelStatus()
          Returns the Java model status object for this exception.
 boolean isDoesNotExist()
          Returns whether this exception indicates that a Java model element does not exist.
 String toString()
          Returns a printable representation of this exception suitable for debugging purposes only.
 
Methods inherited from class org.eclipse.core.runtime.CoreException
getStatus, printStackTrace, printStackTrace, printStackTrace
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JavaModelException

public JavaModelException(Throwable e,
                          int code)
Creates a Java model exception that wrappers the given Throwable. The exception contains a Java-specific status object with severity IStatus.ERROR and the given status code.
Parameters:
exception - the Throwable
code - one of the Java-specific status codes declared in IJavaModelStatusConstants
See Also:
IJavaModelStatusConstants, IStatus.ERROR

JavaModelException

public JavaModelException(CoreException exception)
Creates a Java model exception for the given CoreException. Equivalent to JavaModelException(exception,IJavaModelStatusConstants.CORE_EXCEPTION.
Parameters:
exception - the CoreException

JavaModelException

public JavaModelException(IJavaModelStatus status)
Creates a Java model exception for the given Java-specific status object.
Parameters:
status - the Java-specific status object
Method Detail

getException

public Throwable getException()
Returns the underlying Throwable that caused the failure.
Returns:
the wrappered Throwable, or null if the direct case of the failure was at the Java model layer

getJavaModelStatus

public IJavaModelStatus getJavaModelStatus()
Returns the Java model status object for this exception. Equivalent to (IJavaModelStatus) getStatus().
Returns:
a status object

isDoesNotExist

public boolean isDoesNotExist()
Returns whether this exception indicates that a Java model element does not exist. Such exceptions have a status with a code of IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST. This is a convenience method.
Returns:
true if this exception indicates that a Java model element does not exist
See Also:
IJavaModelStatus.isDoesNotExist(), IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST

toString

public String toString()
Returns a printable representation of this exception suitable for debugging purposes only.
Overrides:
toString in class Throwable

Eclipse JDT
2.1

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.