Validators

public static class Validators


Utility class for validating model objects.

Summary

Public fields

static @NonNull Validators

Public methods

final void
requireNonNegative(double value, @NonNull String name)

Validates that the given Double number is non-negative.

final void
requireNonNegative(int value, @NonNull String name)

Validates that the given Int number is non-negative.

final void
validateAltitude(double altitude)

Validates that the given altitude is in the range 0.0, 63170000.0.

final void
validateFinite(double num)

Validates that the given Double number is finite.

final void
validateFinite(int num)

Validates that the given Int number is finite.

final void
validateFinite(long num)

Validates that the given Long number is finite.

final void
validateHeading(double heading)

Validates that the given heading is in the range 0.0, 360.0.

final void
validateLatitude(double latitude)

Validates that the given latitude is in the range -90.0, 90.0.

final void
validateLongitude(double longitude)

Validates that the given longitude is in the range -180.0, 180.0.

final void
validateRange(double range)

Validates that the given range is non-negative.

final void
validateRoll(double roll)

Validates that the given roll is in the range -360.0, 360.0.

final void
validateTilt(double tilt)

Validates that the given tilt is in the range 0.0, 90.0.

Public fields

INSTANCE

public static @NonNull Validators INSTANCE

Public methods

requireNonNegative

public final void requireNonNegative(double value, @NonNull String name)

Validates that the given Double number is non-negative.

Parameters
double value

The number to validate.

@NonNull String name

The name of the number.

Throws
java.lang.IllegalArgumentException

If the number is negative.

requireNonNegative

public final void requireNonNegative(int value, @NonNull String name)

Validates that the given Int number is non-negative.

Parameters
int value

The number to validate.

@NonNull String name

The name of the number.

Throws
java.lang.IllegalArgumentException

If the number is negative.

validateAltitude

public final void validateAltitude(double altitude)

Validates that the given altitude is in the range 0.0, 63170000.0.

Parameters
double altitude

The altitude to validate.

Throws
java.lang.IllegalArgumentException

If the altitude is not in the range 0.0, 63170000.0.

validateFinite

public final void validateFinite(double num)

Validates that the given Double number is finite.

Parameters
double num

The number to validate.

Throws
java.lang.IllegalArgumentException

If the number is not finite.

validateFinite

public final void validateFinite(int num)

Validates that the given Int number is finite.

Parameters
int num

The number to validate.

Throws
java.lang.IllegalArgumentException

If the number is not finite.

validateFinite

public final void validateFinite(long num)

Validates that the given Long number is finite.

Parameters
long num

The number to validate.

Throws
java.lang.IllegalArgumentException

If the number is not finite.

validateHeading

public final void validateHeading(double heading)

Validates that the given heading is in the range 0.0, 360.0.

Parameters
double heading

The heading to validate.

Throws
java.lang.IllegalArgumentException

If the heading is not in the range 0.0, 360.0.

validateLatitude

public final void validateLatitude(double latitude)

Validates that the given latitude is in the range -90.0, 90.0.

Parameters
double latitude

The latitude to validate.

Throws
java.lang.IllegalArgumentException

If the latitude is not in the range -90.0, 90.0.

validateLongitude

public final void validateLongitude(double longitude)

Validates that the given longitude is in the range -180.0, 180.0.

Parameters
double longitude

The longitude to validate.

Throws
java.lang.IllegalArgumentException

If the longitude is not in the range -180.0, 180.0.

validateRange

public final void validateRange(double range)

Validates that the given range is non-negative.

Parameters
double range

The range to validate.

Throws
java.lang.IllegalArgumentException

If the range is negative.

validateRoll

public final void validateRoll(double roll)

Validates that the given roll is in the range -360.0, 360.0.

Parameters
double roll

The roll to validate.

Throws
java.lang.IllegalArgumentException

If the roll is not in the range -360.0, 360.0.

validateTilt

public final void validateTilt(double tilt)

Validates that the given tilt is in the range 0.0, 90.0.

Parameters
double tilt

The tilt to validate.

Throws
java.lang.IllegalArgumentException

If the tilt is not in the range 0.0, 90.0.