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

io.pelle.mango.client.base.vo.BaseNumberAttributeDescriptor Maven / Gradle / Ivy

The newest version!
package io.pelle.mango.client.base.vo;

import io.pelle.mango.client.base.vo.query.ComparisonOperator;
import io.pelle.mango.client.base.vo.query.IBooleanExpression;
import io.pelle.mango.client.base.vo.query.expressions.CompareExpression;
import io.pelle.mango.client.base.vo.query.expressions.NumberExpression;

@SuppressWarnings("serial")
public class BaseNumberAttributeDescriptor extends BaseExpressionAttributeDescriptor {

	public BaseNumberAttributeDescriptor(IMetaDescriptor parent, String attributeName, Class numberClass) {
		super(parent, attributeName, numberClass, AttributeDescriptor.NO_NATURAL_KEY);
	}

	@Override
	public IBooleanExpression eq(T value) {
		if (value != null) {
			return new CompareExpression(entityFieldExpression, ComparisonOperator.EQUALS, new NumberExpression(value));
		} else {
			return new CompareExpression(entityFieldExpression, ComparisonOperator.IS_NULL, new NumberExpression(value));
		}
	}

	public IBooleanExpression lessThan(T value) {
		return new CompareExpression(entityFieldExpression, ComparisonOperator.LESS, new NumberExpression(value));
	}

	public IBooleanExpression lessThanEquals(T value) {
		return new CompareExpression(entityFieldExpression, ComparisonOperator.LESS_EQUALS, new NumberExpression(value));
	}

	public IBooleanExpression greaterThanEquals(T value) {
		return new CompareExpression(entityFieldExpression, ComparisonOperator.GREATER_EQUALS, new NumberExpression(value));
	}

	public IBooleanExpression greaterThan(T value) {
		return new CompareExpression(entityFieldExpression, ComparisonOperator.GREATER, new NumberExpression(value));
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy