2 * Copyright (c) 2017 Pantheon Technologies, 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.yangtools.yang.parser.spi.meta;
10 import com.google.common.annotations.Beta;
11 import javax.annotation.Nonnull;
14 * Namespace key matching criterion.
18 * @author Robert Varga
21 public abstract class NamespaceKeyCriterion<K> {
23 * Match a key against this criterion.
25 * @param key Key to be matched
26 * @return True if the key matches this criterion, false otherwise.
28 public abstract boolean match(@Nonnull K key);
31 * Select the better match from two candidate keys.
33 * @param first First key
34 * @param second Second key
35 * @return Selected key, must be either first or second key, by identity.
37 public abstract K select(@Nonnull K first, @Nonnull K second);
40 public abstract String toString();
43 public final int hashCode() {
44 return super.hashCode();
48 public final boolean equals(final Object obj) {
49 return super.equals(obj);