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

com.google.sitebricks.conversion.ValidationConverter Maven / Gradle / Ivy

The newest version!
package com.google.sitebricks.conversion;

import java.util.List;
import java.util.Set;

import javax.inject.Singleton;
import javax.validation.ConstraintViolation;

import com.google.common.collect.Lists;

@Singleton
public class ValidationConverter extends ConverterAdaptor>, List> {

    @Override
    public List to(Set> source) {
        List errors = Lists.newArrayList();
        if (source != null) {
            for (ConstraintViolation cv: source) {
                errors.add(cv.getMessage());
            }
        }
        return errors;
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy