Class Functions

java.lang.Object
io.opencensus.common.Functions

public final class Functions extends Object
Commonly used Function instances.
Since:
0.5
  • Field Details

  • Constructor Details

    • Functions

      private Functions()
  • Method Details

    • returnNull

      public static <T> Function<Object,T> returnNull()
      A Function that always ignores its argument and returns null.
      Returns:
      a Function that always ignores its argument and returns null.
      Since:
      0.5
    • returnConstant

      public static <T> Function<Object,T> returnConstant(T constant)
      A Function 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<Object,String> returnToString()
      A Function that always returns the Object.toString() value of the input.
      Returns:
      a Function that always returns the Object.toString() value of the input.
      Since:
      0.17
    • throwIllegalArgumentException

      public static <T> Function<Object,T> throwIllegalArgumentException()
      A Function that always ignores its argument and throws an IllegalArgumentException.
      Returns:
      a Function that always ignores its argument and throws an IllegalArgumentException.
      Since:
      0.5
    • throwAssertionError

      public static <T> Function<Object,T> throwAssertionError()
      A Function that always ignores its argument and throws an AssertionError.
      Returns:
      a Function that always ignores its argument and throws an AssertionError.
      Since:
      0.6