2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.mdsal.binding.api.query;
10 import com.google.common.annotations.Beta;
11 import java.util.regex.Pattern;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yangtools.binding.DataObject;
16 * Builder for a match of a String leaf value.
18 * @param <T> query result type
21 public interface StringMatchBuilder<T extends DataObject> extends ValueMatchBuilder<T, String> {
23 * Match if the leaf exists and its value starts with specified string, i.e. its {@link String#startsWith(String)}
26 * @param str string to match as prefix
27 * @return A ValueMatch
28 * @throws NullPointerException if str is null
30 @NonNull ValueMatch<T> startsWith(String str);
33 * Match if the leaf exists and its value ends with specified string. i.e. its {@link String#endsWith(String)}
36 * @param str string to match as suffix
37 * @return A ValueMatch
38 * @throws NullPointerException if str is null
40 @NonNull ValueMatch<T> endsWith(String str);
43 * Match if the leaf exists and its value contains specified string, i.e. its {@link String#contains(CharSequence)}
46 * @param str the string to search for
47 * @return A ValueMatch
48 * @throws NullPointerException if str is null
50 @NonNull ValueMatch<T> contains(String str);
53 * Match if the leaf exists and its value matches with specified pattern.
55 * @param pattern pattern to check against
56 * @return A ValueMatch
57 * @throws NullPointerException if pattern is null
59 @NonNull ValueMatch<T> matchesPattern(Pattern pattern);