JavaTM 2 Platform
Standard Ed. 6

javax.xml.bind
类 TypeConstraintException

java.lang.Object
  继承者 java.lang.Throwable
      继承者 java.lang.Exception
          继承者 java.lang.RuntimeException
              继承者 javax.xml.bind.TypeConstraintException
所有已实现的接口:
Serializable

public class TypeConstraintException
extends RuntimeException

此异常指示已检测到存在违反动态检查的类型约束的情况。

此异常可由生成的模式派生 Java 内容类的设置方法抛出。但是,由于快速修复验证是 JAXB 提供者支持的一项可选功能,所以并非所有设置方法都将在违反类型约束时抛出此异常。

如果在调用快速失败设置方法时抛出此异常,则要保证属性值保持不变,如同从未调用过该设置方法一样。

从以下版本开始:
JAXB1.0
另请参见:
ValidationEvent, 序列化表格

构造方法摘要
TypeConstraintException(String message)
          构造带指定详细消息的 TypeConstraintException。
TypeConstraintException(String message, String errorCode)
          构造带指定详细消息和特定于供应商的 errorCode 的 TypeConstraintException。
TypeConstraintException(String message, String errorCode, Throwable exception)
          构造带指定的详细消息、特定于供应商的 errorCode 和 linkedException 的 TypeConstraintException。
TypeConstraintException(String message, Throwable exception)
          构造带指定详细消息和 linkedException 的 TypeConstraintException。
TypeConstraintException(Throwable exception)
          构造带有一个 linkedException 的 TypeConstraintException。
 
方法摘要
 String getErrorCode()
          获取特定于供应商的错误代码。
 Throwable getLinkedException()
          获取链接的异常。
 void printStackTrace()
          打印此 TypeConstraintException 及其对 System.err 的堆栈跟踪(如果为非 null,则包括 linkedException 的堆栈跟踪。
 void printStackTrace(PrintStream s)
          打印此 TypeConstraintException 及其对 PrintStream 的堆栈跟踪(如果为非 null,则包括该 linkedException 的堆栈跟踪)。
 void setLinkedException(Throwable exception)
          添加一个链接的异常。
 String toString()
          返回此 TypeConstraintException 的简短描述。
 
从类 java.lang.Throwable 继承的方法
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, setStackTrace
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

TypeConstraintException

public TypeConstraintException(String message)
构造带指定详细消息的 TypeConstraintException。errorCode 和 linkedException 将默认为 null。

参数:
message - 对异常的描述

TypeConstraintException

public TypeConstraintException(String message,
                               String errorCode)
构造带指定详细消息和特定于供应商的 errorCode 的 TypeConstraintException。linkedException 将默认为 null。

参数:
message - 对异常的描述
errorCode - 指定特定于供应商的错误代码的字符串

TypeConstraintException

public TypeConstraintException(Throwable exception)
构造带有一个 linkedException 的 TypeConstraintException。详细消息和特定于供应商的 errorCode 将默认为 null。

参数:
exception - 链接的异常

TypeConstraintException

public TypeConstraintException(String message,
                               Throwable exception)
构造带指定详细消息和 linkedException 的 TypeConstraintException。errorCode 将默认为 null。

参数:
message - 对异常的描述
exception - 链接的异常

TypeConstraintException

public TypeConstraintException(String message,
                               String errorCode,
                               Throwable exception)
构造带指定的详细消息、特定于供应商的 errorCode 和 linkedException 的 TypeConstraintException。

参数:
message - 对异常的描述
errorCode - 指定特定于供应商的错误代码的字符串
exception - 链接的异常
方法详细信息

getErrorCode

public String getErrorCode()
获取特定于供应商的错误代码。

返回:
指定特定于供应商的错误代码的字符串

getLinkedException

public Throwable getLinkedException()
获取链接的异常。

返回:
链接的异常;如果不存在,则返回 null

setLinkedException

public void setLinkedException(Throwable exception)
添加一个链接的异常。

参数:
exception - 链接的异常(允许使用 null 值,该值指示链接的异常不存在或者是未知的)。

toString

public String toString()
返回此 TypeConstraintException 的简短描述。

覆盖:
Throwable 中的 toString
返回:
该 throwable 的字符串表示形式。

printStackTrace

public void printStackTrace(PrintStream s)
打印此 TypeConstraintException 及其对 PrintStream 的堆栈跟踪(如果为非 null,则包括该 linkedException 的堆栈跟踪)。

覆盖:
Throwable 中的 printStackTrace
参数:
s - 用于输出的 PrintStream

printStackTrace

public void printStackTrace()
打印此 TypeConstraintException 及其对 System.err 的堆栈跟踪(如果为非 null,则包括 linkedException 的堆栈跟踪。

覆盖:
Throwable 中的 printStackTrace

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only