All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.opentelemetry.sdk.metrics.internal.view.StringPredicates Maven / Gradle / Ivy

There is a newer version: 1.44.1
Show newest version
/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package io.opentelemetry.sdk.metrics.internal.view;

import java.util.function.Predicate;
import java.util.regex.Pattern;

/**
 * Re-usable string predicates.
 *
 * 

This class is internal and is hence not for public use. Its APIs are unstable and can change * at any time. */ public final class StringPredicates { private StringPredicates() {} /** A string predicate that matches all strings. */ public static final Predicate ALL = value -> true; /** A string predicate that does exact string matching. */ public static Predicate exact(String match) { return match::equals; } /** A string predicate that matches against a regular expression. */ public static Predicate regex(Pattern pattern) { return input -> (input != null) && pattern.matcher(input).matches(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy