Class NameValidator

  • All Implemented Interfaces:
    DbValidator
    Direct Known Subclasses:
    IndexColumnsValidator, TypeNameOnlyValidator

    public class NameValidator
    extends java.lang.Object
    implements DbValidator
    Validates the name of a DbObject using a regular expression. A regular expression can be supplied for each supported database dialect. In addition to dialect specific regular expressions, a default may be supplied - comparisons will fall back to the default if no specific dialect is matched.
    Author:
    Matt Ward
    • Constructor Summary

      Constructors 
      Constructor Description
      NameValidator()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.regex.Pattern getPattern()  
      java.lang.String getProperty​(java.lang.String name)
      Get the current value of a validator property, as set using DbValidator.setProperty(String, String).
      java.util.Set<java.lang.String> getPropertyNames()
      Get the complete set of validator properties in use.
      void setPattern​(java.util.regex.Pattern pattern)  
      void setProperty​(java.lang.String name, java.lang.String value)
      Set a property used by this validator.
      void validate​(DbObject reference, DbObject target, DiffContext ctx)
      Validate the target database object (against the reference object if necessary).
      boolean validates​(java.lang.String fieldName)
      Ask whether the database object's validator is responsible for validating the specified field name.
      boolean validatesFullObject()
      Asks whether the database object's validator is responsible for validating the entire DbObject.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NameValidator

        public NameValidator()
    • Method Detail

      • validate

        public void validate​(DbObject reference,
                             DbObject target,
                             DiffContext ctx)
        Description copied from interface: DbValidator
        Validate the target database object (against the reference object if necessary). Store the validation results on the DiffContext.
        Specified by:
        validate in interface DbValidator
        Parameters:
        reference - DbObject
        target - DbObject
        ctx - DiffContext
      • setPattern

        public void setPattern​(java.util.regex.Pattern pattern)
      • getPattern

        public java.util.regex.Pattern getPattern()
      • setProperty

        public void setProperty​(java.lang.String name,
                                java.lang.String value)
        Description copied from interface: DbValidator
        Set a property used by this validator. Validator properties provided in the schema reference XML files will be set on the validator using this method.
        Specified by:
        setProperty in interface DbValidator
        Parameters:
        name - String
        value - String
      • getPropertyNames

        public java.util.Set<java.lang.String> getPropertyNames()
        Description copied from interface: DbValidator
        Get the complete set of validator properties in use.
        Specified by:
        getPropertyNames in interface DbValidator
      • validates

        public boolean validates​(java.lang.String fieldName)
        Description copied from interface: DbValidator
        Ask whether the database object's validator is responsible for validating the specified field name. This only applies to simple properties - not DbObject instances which should provide their own validators.
        Specified by:
        validates in interface DbValidator
        Parameters:
        fieldName - String
        Returns:
        boolean
      • validatesFullObject

        public boolean validatesFullObject()
        Description copied from interface: DbValidator
        Asks whether the database object's validator is responsible for validating the entire DbObject. If true, then differences are not reported (e.g. table missing from database) as it is the validator's role to worry about presence. If validation and differences are required then report false - even if the validator works at the full object (rather than property) level.
        Specified by:
        validatesFullObject in interface DbValidator
        Returns:
        true if missing or unexpected database objects should not be reported by differencing logic.