com.tangosol.util.filter.ContainsFilter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of coherence Show documentation
Show all versions of coherence Show documentation
Oracle Coherence Community Edition
/*
* Copyright (c) 2000, 2020, Oracle and/or its affiliates.
*
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
package com.tangosol.util.filter;
import com.tangosol.util.Filter;
import com.tangosol.util.MapIndex;
import com.tangosol.util.ValueExtractor;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
/**
* Filter which tests a {@link Collection} or Object array value returned from
* a method invocation for containment of a given value.
*
* More formally, if the specified extractor returns a Collection,
* {@link #evaluate evaluate(o)} is functionally equivalent to the following
* code:
*
* return ((Collection) extract(o)).contains(getValue());
*
* If the specified method returns an Object array, {@link #evaluate
* evaluate(o)} is functionally equivalent to the following code:
*
* return Collections.asList((Object[]) extract(o)).contains(getValue());
*
*
* @param the type of the input argument to the filter
* @param the type of the extracted attribute to use for comparison
*
* @author jh 2005.06.06
*/
public class ContainsFilter
extends ComparisonFilter
implements IndexAwareFilter