Package org.exolab.castor.xml
Class ValidationContext
java.lang.Object
org.exolab.castor.xml.ValidationContext
A class which can be used to hold validation information, used
by the TypeValidator interface.
- Version:
- $Revision$ $Date: 2004-10-06 02:10:17 -0600 (Wed, 06 Oct 2004) $
- Author:
- Keith Visco
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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'.Returns the ClassDescriptorResolver to use during validation.To get theinvalid @link
AbstractInternalContext
Returns the Set of unresolved ID references.boolean
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 whichinvalid @link
AbstractInternalContext
-
Constructor Details
-
ValidationContext
public ValidationContext()
-
-
Method Details
-
getInternalContext
To get theinvalid @link
AbstractInternalContext
- Returns:
- the
invalid @link
AbstractInternalContext
-
setInternalContext
To set whichinvalid @link
AbstractInternalContext
- Parameters:
internalContext
- theinvalid @link
AbstractInternalContext
-
getClassDescriptorResolver
Returns the ClassDescriptorResolver to use during validation.- Returns:
- the ClassDescriptorResolver to use. May be null.
-
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.
- Returns:
- true if fail-fast processing is enabled.
-
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.
- Parameters:
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.
-
isValidated
Checks whether an object has already been validated.- Parameters:
object
- The object for which the check should be performed- Returns:
- True if the object specified has already been validated.
-
addValidated
Adds the specified object to the cache of already validated objects.- Parameters:
object
- Object about to be validated.
-
removeValidated
Removes the specified object from the cache of already validated objects.- Parameters:
object
- The object to be removed from the cache.
-
addID
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.- Parameters:
id
- The current ID- Throws:
ValidationException
- If an ID is used more than once.- See Also:
-
checkIdRef
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.- Parameters:
id
- The ID to check.- Returns:
- true if the provided ID is known.
- See Also:
-
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.- Returns:
- the Set of unresolved ID references.
-
cleanup
public void cleanup()Life-cycle method for proper 'shutdown operations'.
-