Class ValidationContext

java.lang.Object
org.exolab.castor.xml.ValidationContext

public class ValidationContext extends Object
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 Details

    • ValidationContext

      public ValidationContext()
  • Method Details

    • getInternalContext

      public InternalContext getInternalContext()
      To get the AbstractInternalContext to use.
      Returns:
      the AbstractInternalContext?to use
    • setInternalContext

      public void setInternalContext(InternalContext internalContext)
      To set which AbstractInternalContext should be used.
      Parameters:
      internalContext - the AbstractInternalContext to use
    • getClassDescriptorResolver

      public XMLClassDescriptorResolver 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

      protected boolean isValidated(Object object)
      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

      protected void addValidated(Object object)
      Adds the specified object to the cache of already validated objects.
      Parameters:
      object - Object about to be validated.
    • removeValidated

      protected void removeValidated(Object object)
      Removes the specified object from the cache of already validated objects.
      Parameters:
      object - The object to be removed from the cache.
    • 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.
      Parameters:
      id - The current ID
      Throws:
      ValidationException - If an ID is used more than once.
      See Also:
    • 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.
      Parameters:
      id - The ID to check.
      Returns:
      true if the provided ID is known.
      See Also:
    • 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.
      Returns:
      the Set of unresolved ID references.
    • cleanup

      public void cleanup()
      Life-cycle method for proper 'shutdown operations'.