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

com.dooapp.gaedo.finders.collections.GreaterThanEvaluator Maven / Gradle / Ivy

There is a newer version: 1.0.16
Show newest version
package com.dooapp.gaedo.finders.collections;

import java.lang.reflect.Field;

import com.dooapp.gaedo.properties.Property;

/**
 * This evaluator uses non-typesafe Comparable interfaces, since the type has already been ensured elsewhere.
 * @author ndx
 *
 * @param 
 */
@SuppressWarnings("unchecked")
public class GreaterThanEvaluator extends
		AbstractBasicEvaluator implements Evaluator {

	private boolean strictly;
	private Comparable value;

	public GreaterThanEvaluator(Property fieldName, boolean strictly, Comparable value) {
		super(fieldName);
		this.strictly = strictly;
		this.value = value;
	}

	public boolean matches(DataType element) {
		Comparable fieldValue = (Comparable) getValue(element);
		return strictly ? fieldValue.compareTo(value)>0 : fieldValue.compareTo(value)>=0;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy