class Preconditions
Utility class to aid with object comparison with null object handling.
Author
place
| static fun <T : Any!> checkAndGetInstanceOf(object: Any!, clazz: Class<T>!): T | |
| static fun <T : Any!> checkAndGetInstanceOfWithoutException(object: Any!, clazz: Class<T>!): T | |
| static fun checkNotNull(obj: Any!, varName: String!): Unitstatic fun <T : Any!> checkNotNull(reference: T): TEnsures that an object reference passed as a parameter to the calling method is not null. | |
| static fun collectionIsEmpty(col: MutableCollection<*>!): Boolean | |
| static fun <T : Any!> emptyIfNull(iterable: MutableIterable<T>!): MutableIterable<T>! | |
| static fun hashCodeOfObject(o: Any!): Int | |
| static fun isEmpty(s: CharSequence!): Boolean | |
| static fun isEqual(o1: Any!, o2: Any!): BooleanCheck if two objects are equal. This handles the objects being null. When not null the objects equals() method is used. | |
| static fun isNotEmpty(s: CharSequence!): Boolean | |
| static fun isNotNull(object: Any!): Boolean | |
| static fun <T : Any!> nonNullOr(value: T?, defaultValue: T): T | |
| static fun <T : Any!> requireNonNull(object: T, message: String!): TChecks if the given object is not null. If the object is not null then it's returned, throw  | |
| static fun <T : CharSequence!> requireNotEmpty(charSequence: T?, message: String): TChecks if the given charseqence is not empty. If the object is empty or null then  | |
| static fun <T : Any!> requireNull(object: T, message: String): UnitChecks if the given object is null. If the object is not null then  | |
| static fun requireTrue(precondition: Boolean, message: String): UnitChecks if the given precondition is true. If the object is false then  |