Class AbstractValidator<O>

  • Type Parameters:
    O - type of bean to validate
    Direct Known Subclasses:
    BeanListValidator, SimpleBeanValidator

    public abstract class AbstractValidator<O>
    extends Object
    TODO
    Since:
    2.5.2
    Author:
    Tony Chemit - chemit@codelutin.com
    • Method Detail

      • isChanged

        public boolean isChanged()
        Obtain the changed property value. Returns true if bean was modified since last time a bean was attached.
        Returns:
        true if bean was modified since last attachement of a bean.
      • setChanged

        public void setChanged​(boolean changed)
        To force the value of the property changed.
        Parameters:
        changed - flag to force reset of property changed
      • isCanValidate

        public boolean isCanValidate()
      • setCanValidate

        public void setCanValidate​(boolean canValidate)
      • isValid

        public boolean isValid()
        Obtain the valid property value.
        Returns:
        true if attached bean is valid (no error or fatal messages)
      • setValid

        public void setValid​(boolean valid)
        Change the value of the valid property.
        Parameters:
        valid - the new value of the property
      • getContext

        public String getContext()
      • setContext

        public void setContext​(String context)
      • getEffectiveFields

        public Set<String> getEffectiveFields()
      • doValidate

        public abstract void doValidate()
      • hasFatalErrors

        public abstract boolean hasFatalErrors()
      • hasErrors

        public abstract boolean hasErrors()
      • hasWarnings

        public abstract boolean hasWarnings()
      • hasInfos

        public abstract boolean hasInfos()
      • isValid

        public abstract boolean isValid​(String fieldName)
      • convert

        public abstract <T> T convert​(O bean,
                                      String fieldName,
                                      String value,
                                      Class<T> valueClass)
      • doValidate

        protected abstract void doValidate​(O bean)
      • getType

        public Class<O> getType()
      • containsField

        public boolean containsField​(String fieldName)
        Test a the validator contains the field given his name
        Parameters:
        fieldName - the name of the searched field
        Returns:
        true if validator contaisn this field, false otherwise
      • removePropertyChangeListener

        public void removePropertyChangeListener​(PropertyChangeListener listener)
      • firePropertyChange

        public void firePropertyChange​(String propertyName,
                                       Object oldValue,
                                       Object newValue)