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

com.github.antelopeframework.mybatis.criterion.NotExpression Maven / Gradle / Ivy

There is a newer version: 1.1.5
Show newest version
package com.github.antelopeframework.mybatis.criterion;

import lombok.Getter;

/**
 * A criterion that is a wrapper for another, negating the wrapped one.
 *
 * @author yangzhi.yzh
 */
@Getter
public class NotExpression implements Criterion {
	private static final long serialVersionUID = 1L;
	
	private Criterion criterion;

	/**
	 * Constructs a NotExpression
	 *
	 * @param criterion The expression to wrap and negate
	 *
	 * @see Restrictions#not
	 */
	protected NotExpression(Criterion criterion) {
		this.criterion = criterion;
	}

	@Override
	public String toSqlString(CriteriaQuery criteriaQuery) {
		return "not " + criterion.toSqlString(criteriaQuery);
	}

	@Override
	public TypedValue[] getTypedValues(CriteriaQuery criteriaQuery) {
		return criterion.getTypedValues(criteriaQuery);
	}
	
	@Override
	public String toString() {
		return "not " + criterion.toString();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy