public class ValidationFailure extends java.lang.Object implements javax.xml.transform.SourceLocator, org.xml.sax.Locator, ConversionResult
This class holds the same information as a ValidationException, except that it is not an exception, and does not carry system overheads such as a stack trace. It is used because operations such as "castable", and validation of values in a union, cause validation failures on a success path and it is costly to throw, or even to create, exception objects on a success path.
?????? |
---|
ValidationFailure(java.lang.Exception exception)
Creates a new ValidationFailure with the given nested
exception.
|
ValidationFailure(java.lang.String message)
Creates a new ValidationException with the given message.
|
?????? | ????? |
---|---|
AtomicValue |
asAtomic()
Calling this method on a ConversionResult returns the AtomicValue that results
from the conversion if the conversion was successful, and throws a ValidationException
explaining the conversion error otherwise.
|
int |
getColumnNumber() |
java.lang.String |
getConstraintClauseNumber()
Get the constraint clause number
|
java.lang.String |
getConstraintName()
Get the constraint name
|
java.lang.String |
getConstraintReference()
Get the constraint name and clause in the format defined in XML Schema Part C (Outcome Tabulations).
|
java.lang.String |
getConstraintReferenceMessage()
Get the constraint reference as a string for inserting into an error message.
|
int |
getConstraintSchemaPart()
Get the "schema part" component of the constraint reference
|
java.lang.String |
getErrorCode() |
int |
getLineNumber() |
javax.xml.transform.SourceLocator |
getLocator() |
java.lang.String |
getMessage() |
java.lang.String |
getPublicId() |
java.lang.String |
getSystemId() |
ValidationException |
makeException() |
void |
setColumnNumber(int column) |
void |
setConstraintReference(int schemaPart,
java.lang.String constraintName,
java.lang.String clause)
Set a reference to the constraint in XML Schema that is not satisfied
|
void |
setConstraintReference(ValidationFailure e)
Copy the constraint reference from another exception object
|
void |
setErrorCode(java.lang.String errorCode) |
void |
setLineNumber(int line) |
void |
setLocator(javax.xml.transform.SourceLocator locator) |
void |
setPublicId(java.lang.String id) |
void |
setSourceLocator(javax.xml.transform.SourceLocator locator) |
void |
setSystemId(java.lang.String id) |
java.lang.String |
toString()
Returns the String representation of this Exception
|
public ValidationFailure(java.lang.String message)
message
- the message for this Exceptionpublic ValidationFailure(java.lang.Exception exception)
exception
- the nested exceptionpublic void setConstraintReference(int schemaPart, java.lang.String constraintName, java.lang.String clause)
schemaPart
- - 1 or 2, depending whether the constraint is in XMLSchema part 1 or part 2constraintName
- - the short name of the constraint in XMLSchema, as a fragment identifier in the
HTML of the XML Schema Part 1 specificationclause
- - the clause number within the description of that constraintpublic void setConstraintReference(ValidationFailure e)
e
- the other exception object from which to copy the informationpublic java.lang.String getConstraintReferenceMessage()
public int getConstraintSchemaPart()
public java.lang.String getConstraintName()
public java.lang.String getConstraintClauseNumber()
public java.lang.String getConstraintReference()
public java.lang.String getMessage()
public java.lang.String toString()
toString
??? java.lang.Object
public java.lang.String getPublicId()
getPublicId
???? javax.xml.transform.SourceLocator
getPublicId
???? org.xml.sax.Locator
public java.lang.String getSystemId()
getSystemId
???? javax.xml.transform.SourceLocator
getSystemId
???? org.xml.sax.Locator
public int getLineNumber()
getLineNumber
???? javax.xml.transform.SourceLocator
getLineNumber
???? org.xml.sax.Locator
public int getColumnNumber()
getColumnNumber
???? javax.xml.transform.SourceLocator
getColumnNumber
???? org.xml.sax.Locator
public void setPublicId(java.lang.String id)
public void setSystemId(java.lang.String id)
public void setLineNumber(int line)
public void setColumnNumber(int column)
public void setLocator(javax.xml.transform.SourceLocator locator)
public void setSourceLocator(javax.xml.transform.SourceLocator locator)
public javax.xml.transform.SourceLocator getLocator()
public void setErrorCode(java.lang.String errorCode)
public java.lang.String getErrorCode()
public ValidationException makeException()
public AtomicValue asAtomic() throws ValidationException
Use this method if you are calling a conversion method that returns a ConversionResult, and if you want to throw an exception if the conversion fails.
asAtomic
???? ConversionResult
ValidationException
- if the conversion was not successful