org.templateproject.pojo.page.boot.support.Order Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of template-utils-pojo Show documentation
Show all versions of template-utils-pojo Show documentation
Provide some common pojo and some common classes for projects.
The newest version!
package org.templateproject.pojo.page.boot.support;
import org.springframework.util.StringUtils;
import java.io.Serializable;
/**
* Created by wuwenbin on 2017/6/10.
*/
public class Order implements Serializable {
private static final Direction DEFAULT_DIRECTION = Direction.ASC;
private final Direction direction;
private final String property;
public Order(String property) {
this(DEFAULT_DIRECTION, property);
}
public Order(Direction direction, String property) {
if (!StringUtils.hasText(property)) {
throw new IllegalArgumentException("Property must not null or empty!");
}
this.direction = direction == null ? DEFAULT_DIRECTION : direction;
this.property = property;
}
public Direction getDirection() {
return direction;
}
public String getProperty() {
return property;
}
public boolean isAscending() {
return this.direction.isAscending();
}
public boolean isDescending() {
return this.direction.isDescending();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy