Sha256: b8bdeb49c1ba034086ab5c488d1f9dda11bf762134a7ad51442d7dfe041aa691

Contents?: true

Size: 1.06 KB

Versions: 101

Compression:

Stored size: 1.06 KB

Contents

package org.embulk.config;

import java.util.Set;
import javax.validation.ConstraintViolation;

public class TaskValidationException
        extends RuntimeException
{
    @SuppressWarnings("unchecked")
    private final Set violations;

    public <T> TaskValidationException(Set<ConstraintViolation<T>> violations)
    {
        super(formatMessage(violations));
        this.violations = violations;
    }

    @SuppressWarnings("unchecked")
    public Set<ConstraintViolation<?>> getViolations()
    {
        return violations;
    }

    private static <T> String formatMessage(Set<ConstraintViolation<T>> violations)
    {
        StringBuilder sb = new StringBuilder();
        sb.append("Configuration task validation failed.");
        for(ConstraintViolation<T> violation : violations) {
            sb.append(" ");
            sb.append(violation.getPropertyPath());
            sb.append(" ");
            sb.append(violation.getMessage());
            sb.append(" but got ");
            sb.append(violation.getInvalidValue());
        }
        return sb.toString();
    }
}

Version data entries

101 entries across 101 versions & 1 rubygems

Version Path
embulk-0.6.3 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.6.2 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.6.1 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.6.0 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.5.5 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.5.4 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.5.3 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.5.2 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.5.1 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.5.0 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.4.10 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.4.9 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.4.8 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.4.7 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.4.6 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.4.5 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.4.4 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.4.3 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.4.2 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.4.1 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java