Guard Class

  • java.lang.Object
    • com.microsoft.azure.elasticdb.core.commons.transientfaulthandling.Guard

public class Guard

Implements the common guard methods.

Method Summary

Modifier and Type Method and Description
void argumentNotGreaterThan(double argumentValue, double ceilingValue, String argumentName)

Checks an argument to ensure that its value doesn't exceed the specified ceiling baseline.

void argumentNotNegativeValue(int argumentValue, String argumentName)

Checks an argument to ensure that its 32-bit signed value isn't negative.

void argumentNotNegativeValue(long argumentValue, String argumentName)

Checks an argument to ensure that its 64-bit signed value isn't negative.

boolean argumentNotNull(Object argumentValue, String argumentName)

Checks an argument to ensure that it isn't null.

boolean argumentNotNullOrEmptyString(String argumentValue, String argumentName)

Checks a string argument to ensure that it isn't null or empty.

Method Details

argumentNotGreaterThan

public static void argumentNotGreaterThan(double argumentValue, double ceilingValue, String argumentName)

Checks an argument to ensure that its value doesn't exceed the specified ceiling baseline.

Parameters:

argumentValue - The Double value of the argument.
ceilingValue - The Double ceiling value of the argument.
argumentName - The name of the argument for diagnostic purposes.

argumentNotNegativeValue

public static void argumentNotNegativeValue(int argumentValue, String argumentName)

Checks an argument to ensure that its 32-bit signed value isn't negative.

Parameters:

argumentValue - The Integer value of the argument.
argumentName - The name of the argument for diagnostic purposes.

argumentNotNegativeValue

public static void argumentNotNegativeValue(long argumentValue, String argumentName)

Checks an argument to ensure that its 64-bit signed value isn't negative.

Parameters:

argumentValue - The Long value of the argument.
argumentName - The name of the argument for diagnostic purposes.

argumentNotNull

public static boolean argumentNotNull(Object argumentValue, String argumentName)

Checks an argument to ensure that it isn't null.

Parameters:

argumentValue - The argument value to check.
argumentName - The name of the argument.

Returns:

The return value should be ignored. It is intended to be used only when validating arguments during instance creation (for example, when calling the base constructor).

argumentNotNullOrEmptyString

public static boolean argumentNotNullOrEmptyString(String argumentValue, String argumentName)

Checks a string argument to ensure that it isn't null or empty.

Parameters:

argumentValue - The argument value to check.
argumentName - The name of the argument.

Returns:

The return value should be ignored. It is intended to be used only when validating arguments during instance creation (for example, when calling the base constructor).

Applies to