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

org.joo.libra.pointer.IsNullPredicate Maven / Gradle / Ivy

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

import org.joo.libra.PredicateContext;
import org.joo.libra.common.CompositionPredicate;
import org.joo.libra.common.HasValue;

/**
 * Represents a is null predicate. It will be satisfied if and only
 * if the given value is null.
 * 
 * @author griever
 *
 */
public class IsNullPredicate implements CompositionPredicate {

	private HasValue value;

	public IsNullPredicate(final HasValue value) {
		this.value = value;
	}

	@Override
	public boolean satisfiedBy(final PredicateContext context) {
		return value.getValue(context) == null;
	}

	public String toString() {
		return "IS_NULL(" + value + ")";
	}
}