001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.data.validation.routines;
003
004/**
005 * Abstract validator superclass to extend Apache Validator routines.
006 * @since 7489
007 */
008public abstract class AbstractValidator {
009
010    private String errorMessage;
011
012    /**
013     * Tests validity of a given value.
014     * @param value Value to test
015     * @return {@code true} if value is valid, {@code false} otherwise
016     */
017    public abstract boolean isValid(String value);
018
019    /**
020     * Returns the name of this validator
021     * @return the name of this validator
022     */
023    public abstract String getValidatorName();
024
025    /**
026     * Replies the error message.
027     * @return the errorMessage
028     */
029    public final String getErrorMessage() {
030        return errorMessage;
031    }
032
033    /**
034     * Sets the error message.
035     * @param errorMessage the errorMessage
036     */
037    protected final void setErrorMessage(String errorMessage) {
038        this.errorMessage = errorMessage;
039    }
040}