org.exolab.castor.xml
Class ValidationContext
java.lang.Object
org.exolab.castor.xml.ValidationContext
public class ValidationContext
extends java.lang.Object
A class which can be used to hold validation information, used
by the TypeValidator interface.
$Revision$ $Date: 2004-10-06 02:10:17 -0600 (Wed, 06 Oct 2004) $
void | addID(String id) - Adds current ID (as seen during (un)marshalling) to the ID cache.
|
protected void | addValidated(Object object) - Adds the specified object to the cache of already validated objects.
|
boolean | checkIdRef(String id) - Checks an ID Reference, returning true if the provided ID is known.
|
void | cleanup() - Life-cycle method for proper 'shutdown operations'.
|
XMLClassDescriptorResolver | getClassDescriptorResolver() - Returns the ClassDescriptorResolver to use during validation.
|
InternalContext | getInternalContext() - To get the
AbstractInternalContext to use.
|
Set | getUnresolvedIdRefs() - Returns the Set of unresolved ID references.
|
boolean | isFailFast() - Returns true if the validation process should fail upon first error
encountered, otherwise the validation processs will attempt to validate
as much as possible (even after the first error is encountered) and
collect as many errors before either returning (no errors) or throwing a
validationException containing the list of errors.
|
protected boolean | isValidated(Object object) - Checks whether an object has already been validated.
|
protected void | removeValidated(Object object) - Removes the specified object from the cache of already validated objects.
|
void | setFailFast(boolean failFast) - Sets the fail-fast flag.
|
void | setInternalContext(InternalContext internalContext) - To set which
AbstractInternalContext should be used.
|
ValidationContext
public ValidationContext()
Creates a new ValidationContext.
addID
public void addID(String id)
throws ValidationException
Adds current ID (as seen during (un)marshalling) to the ID cache. If this
ID was previously added to the Set of unresolved IDs, then remove it from
that Set.
addValidated
protected void addValidated(Object object)
Adds the specified object to the cache of already validated objects.
object
- Object about to be validated.
checkIdRef
public boolean checkIdRef(String id)
Checks an ID Reference, returning true if the provided ID is known. If
the provided ID is not known, it is added to the Set of unresolved ID
references. Note that if this ID is later found, it will be removed
from this Set.
- true if the provided ID is known.
cleanup
public void cleanup()
Life-cycle method for proper 'shutdown operations'.
getClassDescriptorResolver
public XMLClassDescriptorResolver getClassDescriptorResolver()
Returns the ClassDescriptorResolver to use during validation.
- the ClassDescriptorResolver to use. May be null.
getInternalContext
public InternalContext getInternalContext()
To get the AbstractInternalContext
to use.
- the
AbstractInternalContext
?to use
getUnresolvedIdRefs
public Set getUnresolvedIdRefs()
Returns the Set of unresolved ID references. The Set returns is not
modifiable, but is available to be used to list all unresolved
references.
- the Set of unresolved ID references.
isFailFast
public boolean isFailFast()
Returns true if the validation process should fail upon first error
encountered, otherwise the validation processs will attempt to validate
as much as possible (even after the first error is encountered) and
collect as many errors before either returning (no errors) or throwing a
validationException containing the list of errors.
NOTE: DISABLING OF FAIL-FAST IS NOT YET ENABLED.
- true if fail-fast processing is enabled.
isValidated
protected boolean isValidated(Object object)
Checks whether an object has already been validated.
object
- The object for which the check should be performed
- True if the object specified has already been validated.
removeValidated
protected void removeValidated(Object object)
Removes the specified object from the cache of already validated objects.
object
- The object to be removed from the cache.
setFailFast
public void setFailFast(boolean failFast)
Sets the fail-fast flag. Fail-fast is enabled by default. When fail-fast
is enabled (default or by setting the flag to true) the validation
process will throw an exception upon the first error encountered. When
fail-fast is disabled (by setting the flag to false) the validation
processs will attempt to validate even after the first error is
encountered and collect as many errors before either returning (no
errors) or throwing a validationException containing the list of errors.
NOTE: DISABLING FAIL-FAST IS NOT YET ENABLED.
failFast
- a boolean that when true enables fail-fast validation,
otherwise the validator will attempt to validate as much as it can
reporting as many errors as possible before returning.
setInternalContext
public void setInternalContext(InternalContext internalContext)
To set which AbstractInternalContext
should be used.
internalContext
- the AbstractInternalContext
to use
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com