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

org.joo.libra.text.ContainPredicate Maven / Gradle / Ivy

There is a newer version: 2.1.2
Show newest version
package org.joo.libra.text;

import java.util.Arrays;
import java.util.Collection;

import org.joo.libra.common.BinaryPredicate;
import org.joo.libra.common.HasValue;

@SuppressWarnings("rawtypes")
public class ContainPredicate extends BinaryPredicate {

	@SuppressWarnings("unchecked")
	public ContainPredicate(HasValue one, HasValue other) {
		super(one, other);
	}

	@Override
	protected boolean doSatisifiedBy(Object one, Object other) {
		if (one instanceof String && other instanceof String)
			return one.toString().contains(other.toString());
		if (one instanceof Collection)
			return ((Collection)one).contains(other);
		if (one instanceof Object[]) {
			return Arrays.asList((Object[])one).contains(other);
		}
		return false;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy