Package io.opencensus.common
Class Functions
- java.lang.Object
-
- io.opencensus.common.Functions
-
public final class Functions extends java.lang.ObjectCommonly usedFunctioninstances.- Since:
- 0.5
-
-
Field Summary
Fields Modifier and Type Field Description private static Function<java.lang.Object,java.lang.Void>RETURN_NULLprivate static Function<java.lang.Object,java.lang.String>RETURN_TO_STRINGprivate static Function<java.lang.Object,java.lang.Void>THROW_ASSERTION_ERRORprivate static Function<java.lang.Object,java.lang.Void>THROW_ILLEGAL_ARGUMENT_EXCEPTION
-
Constructor Summary
Constructors Modifier Constructor Description privateFunctions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Function<java.lang.Object,T>returnConstant(T constant)AFunctionthat always ignores its argument and returns a constant value.static <T> Function<java.lang.Object,T>returnNull()AFunctionthat always ignores its argument and returnsnull.static Function<java.lang.Object,java.lang.String>returnToString()AFunctionthat always returns theObject.toString()value of the input.static <T> Function<java.lang.Object,T>throwAssertionError()AFunctionthat always ignores its argument and throws anAssertionError.static <T> Function<java.lang.Object,T>throwIllegalArgumentException()AFunctionthat 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()
AFunctionthat always ignores its argument and returnsnull.- Returns:
- a
Functionthat always ignores its argument and returnsnull. - Since:
- 0.5
-
returnConstant
public static <T> Function<java.lang.Object,T> returnConstant(T constant)
AFunctionthat always ignores its argument and returns a constant value.- Returns:
- a
Functionthat always ignores its argument and returns a constant value. - Since:
- 0.5
-
returnToString
public static Function<java.lang.Object,java.lang.String> returnToString()
AFunctionthat always returns theObject.toString()value of the input.- Returns:
- a
Functionthat always returns theObject.toString()value of the input. - Since:
- 0.17
-
throwIllegalArgumentException
public static <T> Function<java.lang.Object,T> throwIllegalArgumentException()
AFunctionthat always ignores its argument and throws anIllegalArgumentException.- Returns:
- a
Functionthat always ignores its argument and throws anIllegalArgumentException. - Since:
- 0.5
-
throwAssertionError
public static <T> Function<java.lang.Object,T> throwAssertionError()
AFunctionthat always ignores its argument and throws anAssertionError.- Returns:
- a
Functionthat always ignores its argument and throws anAssertionError. - Since:
- 0.6
-
-