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

com.yahoo.parsec.validation.ValidateUtil Maven / Gradle / Ivy

// Copyright 2016 Yahoo Inc.
// Licensed under the terms of the Apache license. Please see LICENSE.md file distributed with this work for terms.

package com.yahoo.parsec.validation;

import java.util.List;

/**
 * Created by guang001 on 11/9/15.
 */
public final class ValidateUtil {

    /**
     * Constructor, add for MD recommend.
     */
    private ValidateUtil() {

    }

    /**
     * Build error response object.
     * @param detailMessages detail message list
     * @param errorCode error code
     * @param errorMsg error message
     * @param  detail message object type
     * @return error response object
     */
    public static  ParsecErrorResponse buildErrorResponse(
            List detailMessages,
            int errorCode,
            String errorMsg) {

        ParsecError pve = new ParsecError<>();
        pve.setDetail(detailMessages);
        pve.setCode(errorCode);
        pve.setMessage(errorMsg);

        ParsecErrorResponse pver = new ParsecErrorResponse<>();
        pver.setError(pve);

        return pver;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy