Home | History | Annotate | Download | only in common
      1 /*
      2  * Copyright 2018, OpenCensus Authors
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *     http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package io.opencensus.common;
     18 
     19 /*>>>
     20 import org.checkerframework.checker.nullness.qual.Nullable;
     21 */
     22 
     23 /**
     24  * Represents a function that produces a long-valued result. See {@link
     25  * io.opencensus.metrics.MetricRegistry} for an example of its use.
     26  *
     27  * <p>Note: This class is based on the java.util.ToLongFunction class added in Java 1.8. We cannot
     28  * use the Function from Java 1.8 because this library is Java 1.6 compatible.
     29  *
     30  * @since 0.16
     31  */
     32 public interface ToLongFunction</*@Nullable*/ T> {
     33   /**
     34    * Applies this function to the given argument.
     35    *
     36    * @param value the function argument.
     37    * @return the function result.
     38    */
     39   long applyAsLong(/*@Nullable*/ T value);
     40 }
     41