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

com.amazon.redshift.plugin.utils.CheckUtils Maven / Gradle / Ivy

There is a newer version: 2.1.0.30
Show newest version
package com.amazon.redshift.plugin.utils;

import com.amazon.redshift.plugin.InternalPluginException;

import java.io.IOException;

import static com.amazonaws.util.StringUtils.isNullOrEmpty;

/**
 * All for plugin parameters check.
 */
public class CheckUtils
{
    private CheckUtils()
    {
    }

    public static void checkMissingAndThrows(String parameter, String parameterName)
        throws InternalPluginException
    {
        if (isNullOrEmpty(parameter))
        {
            throw new InternalPluginException("Missing required property: " + parameterName);
        }
    }

    public static void checkInvalidAndThrows(boolean condition, String parameterName)
        throws InternalPluginException
    {
        if (condition)
        {
            throw new InternalPluginException("Invalid property value: " + parameterName);
        }
    }

    public static void checkAndThrowsWithMessage(boolean condition, String message)
        throws InternalPluginException
    {
        if (condition)
        {
            throw new InternalPluginException(message);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy