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.8.15 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.15-java embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.14 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.14-java embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.13 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.13-java embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.12 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.12-java embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.11-java embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.11 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.10 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.10-java embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.9 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.9-java embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.8 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.8-java embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.7 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.7-java embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.6 embulk-core/src/main/java/org/embulk/config/TaskValidationException.java
embulk-0.8.6-java embulk-core/src/main/java/org/embulk/config/TaskValidationException.java