public final class Lambdas extends Object
Modifier and Type | Method and Description |
---|---|
static <T,U> T |
makeLambda(Class<T> lambdaType,
Generator<U> returnValueGenerator,
GenerationStatus status)
Creates an instance of a given "functional interface" type, whose
single abstract method returns values of the type produced by the given
generator.
|
public static <T,U> T makeLambda(Class<T> lambdaType, Generator<U> returnValueGenerator, GenerationStatus status)
Creates an instance of a given "functional interface" type, whose single abstract method returns values of the type produced by the given generator. The arguments to the lambda's single method will be used to seed a random generator that will be used to generate the return value of that method.
junit-quickcheck uses this to create random values for property parameters whose type is determined to be a functional interface. Custom generators for functional interface types can use this also.
T
- the functional interface type tokenU
- the type of the generated return value of the functional
interface methodlambdaType
- a functional interface type tokenreturnValueGenerator
- a generator for the return type of the
functional interface's single methodstatus
- an object to be passed along to the generator that will
produce the functional interface's method return valueIllegalArgumentException
- if lambdaType
is not a
functional interface type© Copyright 2010-2016 Paul R. Holser, Jr. All rights reserved. Licensed under The MIT License. pholser@alumni.rice.edu