- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- javax.xml.bind.JAXBException
-
- All Implemented Interfaces:
-
Serializable
public class JAXBException extends 异常
这是所有JAXB异常的根异常类。- 从以下版本开始:
- 1.6,JAXB 1.0
- 另请参见:
-
JAXBContext,Marshaller,Unmarshaller, Serialized Form
-
-
构造方法摘要
构造方法 Constructor 描述 JAXBException(String message)构造具有指定详细消息的JAXBException。JAXBException(String message, String errorCode)构造具有指定的详细消息和供应商特定的错误代码的JAXBException。JAXBException(String message, String errorCode, Throwable exception)构造具有指定的详细消息,供应商特定的错误代码和linkedException的JAXBException。JAXBException(String message, Throwable exception)构造具有指定的详细消息和linkedException的JAXBException。JAXBException(Throwable exception)使用linkedException构造一个JAXBException。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 ThrowablegetCause()如果原因不存在或未知,则返回此throwable的原因或null。StringgetErrorCode()获取供应商特定的错误代码ThrowablegetLinkedException()获取链接的异常voidprintStackTrace()将此JAXBException及其堆栈跟踪(包括linkedException的堆栈跟踪(如果为非空))System.err到System.err。voidprintStackTrace(PrintStream s)打印此JAXBException及其堆栈跟踪(包括链接异常的堆栈跟踪(如果非空))到PrintStream。voidprintStackTrace(PrintWriter s)打印此JAXBException及其堆栈跟踪(包括链接异常的堆栈跟踪(如果非空))到PrintWriter。voidsetLinkedException(Throwable exception)添加链接异常。StringtoString()返回此JAXBException的简短描述。-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, setStackTrace
-
-
-
-
构造方法详细信息
-
JAXBException
public JAXBException(String message)
构造具有指定详细消息的JAXBException。 errorCode和linkedException将默认为null。- 参数
-
message- 异常的描述
-
JAXBException
public JAXBException(String message, String errorCode)
构造具有指定的详细消息和供应商特定的错误代码的JAXBException。 linkedException将默认为null。- 参数
-
message- 异常的描述 -
errorCode- 指定供应商特定错误代码的字符串
-
JAXBException
public JAXBException(Throwable exception)
使用linkedException构造一个JAXBException。 详细消息和供应商特定的错误代码将默认为null。- 参数
-
exception- 链接异常
-
JAXBException
public JAXBException(String message, Throwable exception)
构造具有指定的详细消息和linkedException的JAXBException。 errorCode将默认为null。- 参数
-
message- 异常的描述 -
exception- 链接异常
-
-
方法详细信息
-
getErrorCode
public String getErrorCode()
获取供应商特定的错误代码- 结果
- 一个指定供应商特定错误代码的字符串
-
getLinkedException
public Throwable getLinkedException()
获取链接的异常- 结果
- 链接的异常,如果没有,则为null
-
setLinkedException
public void setLinkedException(Throwable exception)
添加链接异常。- 参数
-
exception- 链接的异常(允许空值,表示链接的异常不存在或未知)。
-
toString
public String toString()
返回此JAXBException的简短描述。
-
printStackTrace
public void printStackTrace(PrintStream s)
打印此JAXBException及其堆栈跟踪(包括链接异常的堆栈跟踪(如果非空))到PrintStream。- 重写:
-
printStackTrace在Throwable - 参数
-
s- 用于输出的PrintStream
-
printStackTrace
public void printStackTrace()
将此JAXBException及其堆栈跟踪(包括linkedException的堆栈跟踪(如果为非空))System.err到System.err。- 重写:
-
printStackTrace在Throwable
-
printStackTrace
public void printStackTrace(PrintWriter s)
打印此JAXBException及其堆栈跟踪(包括链接异常的堆栈跟踪(如果非空))到PrintWriter。- 重写:
-
printStackTraceThrowable - 参数
-
s- PrintWriter用于输出
-
getCause
public Throwable getCause()
描述从类复制:Throwable如果原因不存在或未知,则返回此throwable的原因或null。 (原因是引发这个可抛掷物的抛掷物)此实现返回通过需要
Throwable的构造函数之一提供的Throwable,或者使用Throwable.initCause(Throwable)方法创建后设置的原因 。 虽然通常不必重写此方法,但是子类可以覆盖它以返回通过其他方法设置的原因。 这适用于在Throwable之前添加链接异常的“传统链接可抛出”。 请注意, 没有必要覆盖任何PrintStackTrace方法,所有这些方法都调用了getCause方法来确定可抛出的原因。
-
-