Package io.opencensus.common
Class Functions
- java.lang.Object
-
- io.opencensus.common.Functions
-
public final class Functions extends java.lang.Object
Commonly usedFunction
instances.- Since:
- 0.5
-
-
Field Summary
Fields Modifier and Type Field Description private static Function<java.lang.Object,java.lang.Void>
RETURN_NULL
private static Function<java.lang.Object,java.lang.String>
RETURN_TO_STRING
private static Function<java.lang.Object,java.lang.Void>
THROW_ASSERTION_ERROR
private static Function<java.lang.Object,java.lang.Void>
THROW_ILLEGAL_ARGUMENT_EXCEPTION
-
Constructor Summary
Constructors Modifier Constructor Description private
Functions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Function<java.lang.Object,T>
returnConstant(T constant)
AFunction
that always ignores its argument and returns a constant value.static <T> Function<java.lang.Object,T>
returnNull()
AFunction
that always ignores its argument and returnsnull
.static Function<java.lang.Object,java.lang.String>
returnToString()
AFunction
that always returns theObject.toString()
value of the input.static <T> Function<java.lang.Object,T>
throwAssertionError()
AFunction
that always ignores its argument and throws anAssertionError
.static <T> Function<java.lang.Object,T>
throwIllegalArgumentException()
AFunction
that always ignores its argument and throws anIllegalArgumentException
.
-
-
-
Field Detail
-
RETURN_NULL
private static final Function<java.lang.Object,java.lang.Void> RETURN_NULL
-
THROW_ILLEGAL_ARGUMENT_EXCEPTION
private static final Function<java.lang.Object,java.lang.Void> THROW_ILLEGAL_ARGUMENT_EXCEPTION
-
THROW_ASSERTION_ERROR
private static final Function<java.lang.Object,java.lang.Void> THROW_ASSERTION_ERROR
-
RETURN_TO_STRING
private static final Function<java.lang.Object,java.lang.String> RETURN_TO_STRING
-
-
Method Detail
-
returnNull
public static <T> Function<java.lang.Object,T> returnNull()
AFunction
that always ignores its argument and returnsnull
.- Returns:
- a
Function
that always ignores its argument and returnsnull
. - Since:
- 0.5
-
returnConstant
public static <T> Function<java.lang.Object,T> returnConstant(T constant)
AFunction
that always ignores its argument and returns a constant value.- Returns:
- a
Function
that always ignores its argument and returns a constant value. - Since:
- 0.5
-
returnToString
public static Function<java.lang.Object,java.lang.String> returnToString()
AFunction
that always returns theObject.toString()
value of the input.- Returns:
- a
Function
that always returns theObject.toString()
value of the input. - Since:
- 0.17
-
throwIllegalArgumentException
public static <T> Function<java.lang.Object,T> throwIllegalArgumentException()
AFunction
that always ignores its argument and throws anIllegalArgumentException
.- Returns:
- a
Function
that always ignores its argument and throws anIllegalArgumentException
. - Since:
- 0.5
-
throwAssertionError
public static <T> Function<java.lang.Object,T> throwAssertionError()
AFunction
that always ignores its argument and throws anAssertionError
.- Returns:
- a
Function
that always ignores its argument and throws anAssertionError
. - Since:
- 0.6
-
-