NullableProperty - xgouchet/Elmyr GitHub Wiki
class NullableProperty<T :
Any
> :
ForgeryProperty
<T?>
This class implements a ReadOnlyProperty, forging a random object with a given probability of being null.
Parameters
delegate
- the delegate that will forge a non-null random object of the desired type
probability
- the probability the instance will be null (default 0.5f)
Constructors
<init>
NullableProperty(delegate:
ForgeryProperty
<T>, probability:
Float
= Forge.HALF_PROBABILITY)
This class implements a ReadOnlyProperty, forging a random object with a given probability of being null.
Parameters
delegate
- the delegate that will forge a non-null random object of the desired type
probability
- the probability the instance will be null (default 0.5f)
Functions
getForgery
fun getForgery(forge:
Forge
): T?
Inheritdoc
Companion Object Functions
nullableForgery
fun <T :
Any
> nullableForgery(delegate:
ForgeryProperty
<T>, probability:
Float
= Forge.HALF_PROBABILITY):
ReadOnlyProperty
<
ForgeryAware
, T?>
Creates a ReadOnlyProperty that will forge a random object with a given probability of being null.
Parameters
delegate
- the delegate that will forge a non-null random object of the desired type
probability
- the probability the instance will be null (default 0.5f)fun <T :
Any
> nullableForgery(probability:
Float
= Forge.HALF_PROBABILITY, lambda:
Forge
.() -> T):
ReadOnlyProperty
<
ForgeryAware
, T?>
Creates a ReadOnlyProperty that will forge a random object with a given probability of being null.
Parameters
lambda
- the lambda that will forge a non-null random object of the desired type
probability
- the probability the instance will be null (default 0.5f)