001package com.nimbusds.infinispan.persistence.common.query;
002
003
004import net.jcip.annotations.Immutable;
005
006
007/**
008 * Simple match query.
009 */
010@Immutable
011public class SimpleMatchQuery<K,V> implements Query {
012        
013        
014        /**
015         * The key.
016         */
017        private final K key;
018        
019        
020        /**
021         * The value.
022         */
023        private final V value;
024        
025        
026        /**
027         * Creates a new simple match query with the specified key / value pair
028         * to match.
029         *
030         * @param key   The key. Must not be {@code null}.
031         * @param value The value. Must not be {@code null}.
032         */
033        public SimpleMatchQuery(final K key, final V value) {
034                if (key == null)
035                        throw new IllegalArgumentException("The key must not be null");
036                this.key = key;
037                if (value == null)
038                        throw new IllegalArgumentException("The value must not be null");
039                this.value = value;
040        }
041        
042        
043        /**
044         * Returns the key to match.
045         *
046         * @return The key.
047         */
048        public K getKey() {
049                return key;
050        }
051        
052        
053        /**
054         * Returns the value to match.
055         *
056         * @return The value.
057         */
058        public V getValue() {
059                return value;
060        }
061        
062        
063        @Override
064        public String toString() {
065                return "[key=" + key + " value=" + value + "]";
066        }
067}