org.hibernate.query.criteria.internal.OrderImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core Show documentation
Show all versions of hibernate-core Show documentation
Hibernate's core ORM functionality
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.query.criteria.internal;
import java.io.Serializable;
import javax.persistence.criteria.Expression;
import javax.persistence.criteria.Order;
/**
* Represents an ORDER BY fragment.
*
* @author Steve Ebersole
*/
public class OrderImpl implements Order, Serializable {
private final Expression expression;
private boolean ascending;
public OrderImpl(Expression expression) {
this( expression, true );
}
public OrderImpl(Expression expression, boolean ascending) {
this.expression = expression;
this.ascending = ascending;
}
public Order reverse() {
ascending = !ascending;
return this;
}
public boolean isAscending() {
return ascending;
}
public Expression getExpression() {
return expression;
}
}