Interface KeyValue

All Superinterfaces:
Comparable<KeyValue>

public interface KeyValue extends Comparable<KeyValue>
Key/value pair representing a dimension of a meter used to classify and drill into measurements.
Since:
1.10.0
  • Field Details

    • NONE_VALUE

      static final String NONE_VALUE
      Use this if you want to indicate that the value is missing.
      See Also:
  • Method Details

    • getKey

      String getKey()
    • getValue

      String getValue()
    • of

      static KeyValue of(String key, String value)
      Creates a KeyValue for the given key and value.
      Parameters:
      key - key of the KeyValue
      value - value for key
      Returns:
      KeyValue
    • of

      static KeyValue of(KeyName keyName, String value)
      Creates a KeyValue for the given KeyName and value.
      Parameters:
      keyName - name of the key of the KeyValue
      value - value for key
      Returns:
      KeyValue
    • of

      static <E> KeyValue of(E element, Function<E,String> keyExtractor, Function<E,String> valueExtractor)
      Creates a KeyValue for the given element by extracting a key and value from it.
      Parameters:
      element - the source element
      keyExtractor - function to extract the key from the element
      valueExtractor - function to extract the value from the element
      Returns:
      KeyValue
    • of

      static <T> KeyValue of(String key, T value, Predicate<? super T> validator)
      Creates a KeyValue for the given key and value and additionally validates it with the Predicate.
      Parameters:
      key - key of the KeyValue
      value - value for key
      validator - the Predicate used for validating the value
      Returns:
      KeyValue
    • of

      static <T> KeyValue of(KeyName keyName, T value, Predicate<? super T> validator)
      Creates a KeyValue for the given KeyName and value and additionally validates it with the Predicate.
      Parameters:
      keyName - name of the key of the KeyValue
      value - value for key
      validator - the Predicate used for validating the value
      Returns:
      KeyValue
    • compareTo

      default int compareTo(KeyValue o)
      Specified by:
      compareTo in interface Comparable<KeyValue>