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

net.jbock.common.ValidationFailure Maven / Gradle / Ivy

There is a newer version: 5.18
Show newest version
package net.jbock.common;

import javax.annotation.processing.Messager;
import javax.lang.model.element.Element;

import static javax.tools.Diagnostic.Kind.ERROR;

public final class ValidationFailure {

    private final Element about;
    private final String message;

    public ValidationFailure(String message, Element about) {
        this.message = message;
        this.about = about;
    }

    public ValidationFailure prepend(String prefix) {
        return new ValidationFailure(prefix + message, about);
    }

    public ValidationFailure about(Element about) {
        return new ValidationFailure(message, about);
    }

    public void writeTo(Messager messager) {
        messager.printMessage(ERROR, message, about);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy