javax.xml.bind

Class TypeConstraintException

public class TypeConstraintException extends RuntimeException

This is a runtime exception. The desired use is for generated set methods which would like to indicate that the specified value is invalid, for example, because a facet restriction wasn't met.

If a generated setter throws a TypeConstraintException, then it is the JAXB providers task to ensure, that the object, on which the setter is invoked, remains unchanged.

Since: JAXB1.0

Author: JSR-31

Constructor Summary
TypeConstraintException(String pMessage)

Creates a new TypeConstraintException with the specified detail message.

TypeConstraintException(String pMessage, String pErrorCode)

Creates a new TypeConstraintException with the specified detail message and vendor specific error code.

TypeConstraintException(Throwable pLinkedException)

Creates a new TypeConstraintException with the specified linked exception.

TypeConstraintException(String pMessage, Throwable pLinkedException)

Creates a new TypeConstraintException with the specified detail message and linked exception.

TypeConstraintException(String pMessage, String pErrorCode, Throwable pLinkedException)

Creates a new TypeConstraintException with the specified detail message, error code, and linked exception.

Method Summary
StringgetErrorCode()

Returns the vendor specific error code, if any, or null.

ThrowablegetLinkedException()

Returns the linked exception, if any, or null.

voidsetLinkedException(Throwable pLinkedException)

Sets the linked exception.

StringtoString()

Converts the linked exception into a String.

Constructor Detail

TypeConstraintException

public TypeConstraintException(String pMessage)

Creates a new TypeConstraintException with the specified detail message.

Parameters: pMessage The detail message.

TypeConstraintException

public TypeConstraintException(String pMessage, String pErrorCode)

Creates a new TypeConstraintException with the specified detail message and vendor specific error code.

Parameters: pMessage The detail message. pErrorCode The error code.

TypeConstraintException

public TypeConstraintException(Throwable pLinkedException)

Creates a new TypeConstraintException with the specified linked exception.

Parameters: pLinkedException The linked exception.

TypeConstraintException

public TypeConstraintException(String pMessage, Throwable pLinkedException)

Creates a new TypeConstraintException with the specified detail message and linked exception.

Parameters: pMessage The detail message. pLinkedException The linked exception.

TypeConstraintException

public TypeConstraintException(String pMessage, String pErrorCode, Throwable pLinkedException)

Creates a new TypeConstraintException with the specified detail message, error code, and linked exception.

Parameters: pMessage The detail message. pErrorCode The vendor specific error code. pLinkedException The linked exception.

Method Detail

getErrorCode

public String getErrorCode()

Returns the vendor specific error code, if any, or null.

getLinkedException

public Throwable getLinkedException()

Returns the linked exception, if any, or null.

setLinkedException

public void setLinkedException(Throwable pLinkedException)

Sets the linked exception.

Parameters: pLinkedException The linked exception or null.

toString

public String toString()

Converts the linked exception into a String. Overridden, because the returned string should contain the vendor specific error code, if any.