Class Assert
- java.lang.Object
-
- com.apple.foundationdb.relational.util.Assert
-
@API(EXPERIMENTAL) public final class Assert extends java.lang.Object
A set of helper methods for validating input, pre-conditions, ... etc.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <S,T>
ScastUnchecked(T object, java.lang.Class<S> clazz)
static <S,T>
ScastUnchecked(T object, java.lang.Class<S> clazz, ErrorCode errorCodeIfCastFailed, java.util.function.Supplier<java.lang.String> messageSupplier)
static RelationalException
fail()
static RelationalException
fail(ErrorCode failErrorCode, java.lang.String failMessage)
static RelationalException
fail(java.lang.String failMessage)
static UncheckedRelationalException
failUnchecked()
static UncheckedRelationalException
failUnchecked(ErrorCode failErrorCode, java.lang.String failMessage)
static UncheckedRelationalException
failUnchecked(java.lang.String failMessage)
static void
isNull(java.lang.Object object)
static void
isNull(java.lang.Object object, ErrorCode errorCodeIfNotTrue, java.lang.String messageIfNull)
static void
isNull(java.lang.Object object, java.lang.String messageIfNull)
static void
isNullUnchecked(java.lang.Object object)
static void
isNullUnchecked(java.lang.Object object, ErrorCode errorCodeIfNotNull, java.lang.String messageIfNotNull)
static void
isNullUnchecked(java.lang.Object object, ErrorCode errorCodeIfNotNull, java.util.function.Supplier<java.lang.String> messageSupplier)
static void
isNullUnchecked(java.lang.Object object, java.lang.String messageIfNotNull)
static <T> T
notNull(T object)
static <T> T
notNull(T object, ErrorCode errorCodeIfNotTrue, java.lang.String messageIfNull)
static <T> T
notNull(T object, java.lang.String messageIfNull)
static <T> T
notNullUnchecked(T object)
static <T> T
notNullUnchecked(T object, ErrorCode errorCodeIfNull, java.lang.String messageIfNull)
static <T> T
notNullUnchecked(T object, ErrorCode errorCodeIfNull, java.lang.String messageTemplate, java.lang.Object messageValue)
static <T> T
notNullUnchecked(T object, ErrorCode errorCodeIfNull, java.util.function.Supplier<java.lang.String> messageSupplier)
static <T> T
notNullUnchecked(T object, java.lang.String messageIfNull)
static void
that(boolean mustBeTrue)
static void
that(boolean mustBeTrue, ErrorCode errorCodeIfNotTrue, java.lang.String messageIfNotTrue)
static void
that(boolean mustBeTrue, ErrorCode errorCodeIfNotTrue, java.lang.String messageFormat, java.lang.Object messageValue)
static void
that(boolean mustBeTrue, ErrorCode errorCodeIfNotTrue, java.lang.String messageFormat, java.lang.Object messageValue1, java.lang.Object messageValue2)
static void
that(boolean mustBeTrue, ErrorCode errorCodeIfNotTrue, java.util.function.Supplier<java.lang.String> messageSupplier)
static void
that(boolean mustBeTrue, java.lang.String messageIfNotTrue)
static void
thatUnchecked(boolean mustBeTrue)
static void
thatUnchecked(boolean mustBeTrue, ErrorCode errorCodeIfNotTrue, java.lang.String messageIfNotTrue)
static void
thatUnchecked(boolean mustBeTrue, ErrorCode errorCodeIfNotTrue, java.lang.String messageTemplate, java.lang.Object messageValue)
static void
thatUnchecked(boolean mustBeTrue, ErrorCode errorCodeIfNotTrue, java.lang.String messageTemplate, java.lang.Object messageValue1, java.lang.Object messageValue2)
static void
thatUnchecked(boolean mustBeTrue, ErrorCode errorCodeIfNotTrue, java.util.function.Supplier<java.lang.String> messageSupplier)
static void
thatUnchecked(boolean mustBeTrue, java.lang.String messageIfNotTrue)
-
-
-
Method Detail
-
that
public static void that(boolean mustBeTrue) throws RelationalException
- Throws:
RelationalException
-
that
public static void that(boolean mustBeTrue, @Nonnull java.lang.String messageIfNotTrue) throws RelationalException
- Throws:
RelationalException
-
that
public static void that(boolean mustBeTrue, @Nonnull ErrorCode errorCodeIfNotTrue, @Nonnull java.util.function.Supplier<java.lang.String> messageSupplier) throws RelationalException
- Throws:
RelationalException
-
that
public static void that(boolean mustBeTrue, @Nonnull ErrorCode errorCodeIfNotTrue, @Nonnull java.lang.String messageIfNotTrue) throws RelationalException
- Throws:
RelationalException
-
that
public static void that(boolean mustBeTrue, @Nonnull ErrorCode errorCodeIfNotTrue, @Nonnull java.lang.String messageFormat, @Nonnull java.lang.Object messageValue) throws RelationalException
- Throws:
RelationalException
-
that
public static void that(boolean mustBeTrue, @Nonnull ErrorCode errorCodeIfNotTrue, @Nonnull java.lang.String messageFormat, @Nonnull java.lang.Object messageValue1, @Nonnull java.lang.Object messageValue2) throws RelationalException
- Throws:
RelationalException
-
notNull
public static <T> T notNull(T object) throws RelationalException
- Throws:
RelationalException
-
notNull
public static <T> T notNull(T object, @Nonnull java.lang.String messageIfNull) throws RelationalException
- Throws:
RelationalException
-
notNull
public static <T> T notNull(T object, @Nonnull ErrorCode errorCodeIfNotTrue, @Nonnull java.lang.String messageIfNull) throws RelationalException
- Throws:
RelationalException
-
isNull
public static void isNull(java.lang.Object object) throws RelationalException
- Throws:
RelationalException
-
isNull
public static void isNull(java.lang.Object object, @Nonnull java.lang.String messageIfNull) throws RelationalException
- Throws:
RelationalException
-
isNull
public static void isNull(java.lang.Object object, @Nonnull ErrorCode errorCodeIfNotTrue, @Nonnull java.lang.String messageIfNull) throws RelationalException
- Throws:
RelationalException
-
fail
public static RelationalException fail() throws RelationalException
- Throws:
RelationalException
-
fail
public static RelationalException fail(@Nonnull java.lang.String failMessage) throws RelationalException
- Throws:
RelationalException
-
fail
public static RelationalException fail(@Nonnull ErrorCode failErrorCode, @Nonnull java.lang.String failMessage) throws RelationalException
- Throws:
RelationalException
-
thatUnchecked
public static void thatUnchecked(boolean mustBeTrue)
-
thatUnchecked
public static void thatUnchecked(boolean mustBeTrue, @Nonnull java.lang.String messageIfNotTrue)
-
thatUnchecked
public static void thatUnchecked(boolean mustBeTrue, @Nonnull ErrorCode errorCodeIfNotTrue, @Nonnull java.util.function.Supplier<java.lang.String> messageSupplier)
-
thatUnchecked
public static void thatUnchecked(boolean mustBeTrue, @Nonnull ErrorCode errorCodeIfNotTrue, @Nonnull java.lang.String messageIfNotTrue)
-
thatUnchecked
public static void thatUnchecked(boolean mustBeTrue, @Nonnull ErrorCode errorCodeIfNotTrue, @Nonnull java.lang.String messageTemplate, @Nonnull java.lang.Object messageValue)
-
thatUnchecked
public static void thatUnchecked(boolean mustBeTrue, @Nonnull ErrorCode errorCodeIfNotTrue, @Nonnull java.lang.String messageTemplate, @Nonnull java.lang.Object messageValue1, @Nonnull java.lang.Object messageValue2)
-
notNullUnchecked
public static <T> T notNullUnchecked(T object)
-
notNullUnchecked
public static <T> T notNullUnchecked(T object, @Nonnull java.lang.String messageIfNull)
-
notNullUnchecked
public static <T> T notNullUnchecked(T object, @Nonnull ErrorCode errorCodeIfNull, @Nonnull java.util.function.Supplier<java.lang.String> messageSupplier)
-
notNullUnchecked
public static <T> T notNullUnchecked(T object, @Nonnull ErrorCode errorCodeIfNull, @Nonnull java.lang.String messageIfNull)
-
notNullUnchecked
public static <T> T notNullUnchecked(T object, @Nonnull ErrorCode errorCodeIfNull, @Nonnull java.lang.String messageTemplate, @Nonnull java.lang.Object messageValue)
-
isNullUnchecked
public static void isNullUnchecked(java.lang.Object object)
-
isNullUnchecked
public static void isNullUnchecked(java.lang.Object object, @Nonnull java.lang.String messageIfNotNull)
-
isNullUnchecked
public static void isNullUnchecked(java.lang.Object object, @Nonnull ErrorCode errorCodeIfNotNull, @Nonnull java.util.function.Supplier<java.lang.String> messageSupplier)
-
isNullUnchecked
public static void isNullUnchecked(java.lang.Object object, @Nonnull ErrorCode errorCodeIfNotNull, @Nonnull java.lang.String messageIfNotNull)
-
failUnchecked
public static UncheckedRelationalException failUnchecked()
-
failUnchecked
public static UncheckedRelationalException failUnchecked(@Nonnull java.lang.String failMessage)
-
failUnchecked
public static UncheckedRelationalException failUnchecked(@Nonnull ErrorCode failErrorCode, @Nonnull java.lang.String failMessage)
-
castUnchecked
@Nonnull public static <S,T> S castUnchecked(T object, java.lang.Class<S> clazz)
-
castUnchecked
@Nonnull public static <S,T> S castUnchecked(T object, java.lang.Class<S> clazz, @Nonnull ErrorCode errorCodeIfCastFailed, @Nonnull java.util.function.Supplier<java.lang.String> messageSupplier)
-
-