All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.srplib.validation.Validatable Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package org.srplib.validation;

import java.util.List;

/**
 * Encapsulates an object which can be validated.
 *
 * 

Validatable is unaware of UI framework and contains only validation specific logic.

* *

Usage patterns: *

    *
  1. Extract value from to be-validated-component and wap it with Validatable implementation (e.g. DefaultValidatable).
  2. *
  3. Pass resulting validatable to all associated validators
  4. *
  5. Query validatable.hasErrors() method
  6. *
* *

* * @author Anton Pechinsky */ public interface Validatable { /** * Returns value to be validated. * * @return an object representing value. */ T getValue(); /** * Tests if this object has errors or not. * * @return true if object has errors, false otherwise */ boolean hasErrors(); /** * Adds error to this object. * * @param error ValidationError an error. */ void addError(ValidationError error); /** * Returns validation error associated with this object. * * @return a List of validation errors. If there are errors then empty list is returned. */ List getErrors(); /** * Returns a reference to component which is being validated. * * @return Object validation context */ Object getContext(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy