public final class Functions extends Object
Modifier and Type | Field and Description |
---|---|
static DoubleFunction |
AGE
Age function based on the system clock.
|
static ValueFunction |
COLLECTION_SIZE
Returns the size of the collection.
|
static DoubleFunction |
IDENTITY
Identity function that just returns the passed in value if it implements the
Number interface. |
static ValueFunction |
MAP_SIZE
Returns the size of the map.
|
Modifier and Type | Method and Description |
---|---|
static DoubleFunction |
age(Clock clock)
Returns a function that computes the age in seconds.
|
static ValueFunction |
invokeMethod(Method method)
Returns a function that invokes a method on the object via reflection.
|
public static final DoubleFunction IDENTITY
Number
interface.public static final ValueFunction COLLECTION_SIZE
public static final ValueFunction MAP_SIZE
public static final DoubleFunction AGE
age(Clock)
for more details.public static DoubleFunction age(Clock clock)
System.currentTimeMillis()
.clock
- Clock used to get the current time for comparing with the passed in value.public static ValueFunction invokeMethod(Method method)
Number
. The method will be set accessible so that private
methods can be used.method
- Method to execute on the passed in object.