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

io.vertx.up.uca.rs.regular.BaseRuler Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package io.vertx.up.uca.rs.regular;

import io.vertx.up.atom.Rule;
import io.vertx.up.exception.WebException;
import io.vertx.up.exception.web._400ValidationRuleException;
import io.vertx.up.log.Annal;

public abstract class BaseRuler implements Ruler {

    protected WebException failure(
            final String field,
            final Object value,
            final Rule rule) {
        final String message = rule.getMessage();
        final WebException error = new _400ValidationRuleException(
                getClass(), field, value, message);
        error.setReadible(message);
        getLogger().info(Info.MSG_FAILURE, error.toJson());
        return error;
    }

    protected Annal getLogger() {
        return Annal.get(getClass());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy