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

com.datastax.dse.driver.api.core.graph.predicates.CqlCollection Maven / Gradle / Ivy

The newest version!
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.datastax.dse.driver.api.core.graph.predicates;

import com.datastax.dse.driver.internal.core.graph.CqlCollectionPredicate;
import java.util.Collection;
import java.util.Map;
import org.apache.tinkerpop.gremlin.process.traversal.P;
import org.javatuples.Pair;

/**
 * Predicates that can be used on CQL collections (lists, sets and maps).
 *
 * 

Note: CQL collection predicates are only available when using the binary subprotocol. */ public class CqlCollection { /** * Checks if the target collection contains the given value. * * @param value the value to look for; cannot be {@code null}. * @return a predicate to apply in a {@link * org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal}. */ @SuppressWarnings("unchecked") public static , V> P contains(V value) { return new P(CqlCollectionPredicate.contains, value); } /** * Checks if the target map contains the given key. * * @param key the key to look for; cannot be {@code null}. * @return a predicate to apply in a {@link * org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal}. */ @SuppressWarnings("unchecked") public static , K> P containsKey(K key) { return new P(CqlCollectionPredicate.containsKey, key); } /** * Checks if the target map contains the given value. * * @param value the value to look for; cannot be {@code null}. * @return a predicate to apply in a {@link * org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal}. */ @SuppressWarnings("unchecked") public static , V> P containsValue(V value) { return new P(CqlCollectionPredicate.containsValue, value); } /** * Checks if the target map contains the given entry. * * @param key the key to look for; cannot be {@code null}. * @param value the value to look for; cannot be {@code null}. * @return a predicate to apply in a {@link * org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal}. */ @SuppressWarnings("unchecked") public static , K, V> P entryEq(K key, V value) { return new P(CqlCollectionPredicate.entryEq, new Pair<>(key, value)); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy