FileDocCategorySizeDatePackage
TypeConstraintException.javaAPI DocJava SE 6 API5069Tue Jun 10 00:27:04 BST 2008javax.xml.bind

TypeConstraintException

public class TypeConstraintException extends RuntimeException
This exception indicates that a violation of a dynamically checked type constraint was detected.

This exception can be thrown by the generated setter methods of the schema derived Java content classes. However, since fail-fast validation is an optional feature for JAXB Providers to support, not all setter methods will throw this exception when a type constraint is violated.

If this exception is throw while invoking a fail-fast setter, the value of the property is guaranteed to remain unchanged, as if the setter were never called.

author
  • Ryan Shoemaker, Sun Microsystems, Inc.
  • Joe Fialli, Sun Microsystems, Inc.
version
$Revision: 1.2 $
see
ValidationEvent
since
JAXB1.0

Fields Summary
private String
errorCode
Vendor specific error code
private Throwable
linkedException
Exception reference
Constructors Summary
public TypeConstraintException(String message)
Construct a TypeConstraintException with the specified detail message. The errorCode and linkedException will default to null.

param
message a description of the exception

        this( message, null, null );
    
public TypeConstraintException(String message, String errorCode)
Construct a TypeConstraintException with the specified detail message and vendor specific errorCode. The linkedException will default to null.

param
message a description of the exception
param
errorCode a string specifying the vendor specific error code

        this( message, errorCode, null );
    
public TypeConstraintException(Throwable exception)
Construct a TypeConstraintException with a linkedException. The detail message and vendor specific errorCode will default to null.

param
exception the linked exception

        this( null, null, exception );
    
public TypeConstraintException(String message, Throwable exception)
Construct a TypeConstraintException with the specified detail message and linkedException. The errorCode will default to null.

param
message a description of the exception
param
exception the linked exception

        this( message, null, exception );
    
public TypeConstraintException(String message, String errorCode, Throwable exception)
Construct a TypeConstraintException with the specified detail message, vendor specific errorCode, and linkedException.

param
message a description of the exception
param
errorCode a string specifying the vendor specific error code
param
exception the linked exception

        super( message );
        this.errorCode = errorCode;
        this.linkedException = exception;
    
Methods Summary
public java.lang.StringgetErrorCode()
Get the vendor specific error code

return
a string specifying the vendor specific error code

        return this.errorCode;
    
public java.lang.ThrowablegetLinkedException()
Get the linked exception

return
the linked Exception, null if none exists

        return linkedException;
    
public voidprintStackTrace(java.io.PrintStream s)
Prints this TypeConstraintException and its stack trace (including the stack trace of the linkedException if it is non-null) to the PrintStream.

param
s PrintStream to use for output

        if( linkedException != null ) {
          linkedException.printStackTrace(s);
          s.println("--------------- linked to ------------------");
        }

        super.printStackTrace(s);
    
public voidprintStackTrace()
Prints this TypeConstraintException and its stack trace (including the stack trace of the linkedException if it is non-null) to System.err.

        printStackTrace(System.err);
    
public synchronized voidsetLinkedException(java.lang.Throwable exception)
Add a linked Exception.

param
exception the linked Exception (A null value is permitted and indicates that the linked exception does not exist or is unknown).

        this.linkedException = exception;
    
public java.lang.StringtoString()
Returns a short description of this TypeConstraintException.

        return linkedException == null ? 
            super.toString() :
            super.toString() + "\n - with linked exception:\n[" +
                                linkedException.toString()+ "]";