Package com.hexagonkt.core
Class ChecksKt
-
- All Implemented Interfaces:
public final class ChecksKt
-
-
Method Summary
Modifier and Type Method Description final static <T extends Any> UnitrequireNotBlank(T $self, KProperty1<T, CharSequence> field)final static <T extends Any> UnitrequireNotBlanks(T $self, KProperty1<T, Collection<CharSequence>> field)final static <T extends Any, N extends Any> UnitrequireGreater(T $self, KProperty1<T, Comparable<N>> field, N min)final static <T extends Any, N extends Any> UnitrequireGreater(T $self, KProperty1<T, Comparable<N>> field, KProperty1<T, N> field2)final static <T extends Any, N extends Any> UnitrequireGreaterOrEquals(T $self, KProperty1<T, Comparable<N>> field, N min)final static <T extends Any, N extends Any> UnitrequireGreaterOrEquals(T $self, KProperty1<T, Comparable<N>> field, KProperty1<T, N> field2)final static <T extends Any, N extends Any> UnitrequireLower(T $self, KProperty1<T, Comparable<N>> field, N min)final static <T extends Any, N extends Any> UnitrequireLower(T $self, KProperty1<T, Comparable<N>> field, KProperty1<T, N> field2)final static <T extends Any, N extends Any> UnitrequireLowerOrEquals(T $self, KProperty1<T, Comparable<N>> field, N min)final static <T extends Any, N extends Any> UnitrequireLowerOrEquals(T $self, KProperty1<T, Comparable<N>> field, KProperty1<T, N> field2)final static <Z extends Any> Collection<Z>checkSize(Collection<Z> $self, IntRange count)Ensure a collection has a fixed number of elements. final static Unitcheck(String message, Function0<Unit> blocks)Execute a list of code block collecting the exceptions they may throw, in case there is any error, it throws a MultipleException with all the thrown exceptions. -
-
Method Detail
-
requireNotBlank
final static <T extends Any> Unit requireNotBlank(T $self, KProperty1<T, CharSequence> field)
-
requireNotBlanks
final static <T extends Any> Unit requireNotBlanks(T $self, KProperty1<T, Collection<CharSequence>> field)
-
requireGreater
final static <T extends Any, N extends Any> Unit requireGreater(T $self, KProperty1<T, Comparable<N>> field, N min)
-
requireGreater
final static <T extends Any, N extends Any> Unit requireGreater(T $self, KProperty1<T, Comparable<N>> field, KProperty1<T, N> field2)
-
requireGreaterOrEquals
final static <T extends Any, N extends Any> Unit requireGreaterOrEquals(T $self, KProperty1<T, Comparable<N>> field, N min)
-
requireGreaterOrEquals
final static <T extends Any, N extends Any> Unit requireGreaterOrEquals(T $self, KProperty1<T, Comparable<N>> field, KProperty1<T, N> field2)
-
requireLower
final static <T extends Any, N extends Any> Unit requireLower(T $self, KProperty1<T, Comparable<N>> field, N min)
-
requireLower
final static <T extends Any, N extends Any> Unit requireLower(T $self, KProperty1<T, Comparable<N>> field, KProperty1<T, N> field2)
-
requireLowerOrEquals
final static <T extends Any, N extends Any> Unit requireLowerOrEquals(T $self, KProperty1<T, Comparable<N>> field, N min)
-
requireLowerOrEquals
final static <T extends Any, N extends Any> Unit requireLowerOrEquals(T $self, KProperty1<T, Comparable<N>> field, KProperty1<T, N> field2)
-
checkSize
final static <Z extends Any> Collection<Z> checkSize(Collection<Z> $self, IntRange count)
Ensure a collection has a fixed number of elements.
- Parameters:
count- Required number of elements.- Returns:
Receiver reference (to allow call chaining).
-
check
final static Unit check(String message, Function0<Unit> blocks)
Execute a list of code block collecting the exceptions they may throw, in case there is any error, it throws a MultipleException with all the thrown exceptions.
- Parameters:
message- Error message.blocks- Blocks of code executed and checked.
-
-
-
-