這期內(nèi)容當(dāng)中小編將會給大家?guī)碛嘘P(guān)Spring中如何定義Range范圍對象,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
1 實現(xiàn)方式
1.1 范圍對象Range定義
import java.io.Serializable; public class Range<E> implements Serializable { private static final long serialVersionUID = 1L; private String field; private Comparable from; private Comparable to; private Boolean includeNull; public Range(String field) { this.field = field; } public Range(String field, Comparable from, Comparable to) { this.field = field; this.from = from; this.to = to; } public Range(String field, Comparable from, Comparable to, Boolean includeNull) { this.field = field; this.from = from; this.to = to; this.includeNull = includeNull; } public Range(Range<E> other) { this.field = other.getField(); this.from = other.getFrom(); this.to = other.getTo(); this.includeNull = other.getIncludeNull(); } public String getField() { return field; } public Comparable getFrom() { return from; } public void setFrom(Comparable from) { this.from = from; } public boolean isFromSet() { return getFrom() != null; } public Comparable getTo() { return to; } public void setTo(Comparable to) { this.to = to; } public boolean isToSet() { return getTo() != null; } public void setIncludeNull(boolean includeNull) { this.includeNull = includeNull; } public Boolean getIncludeNull() { return includeNull; } public boolean isIncludeNullSet() { return includeNull != null; } public boolean isBetween() { return isFromSet() && isToSet(); } public boolean isSet() { return isFromSet() || isToSet() || isIncludeNullSet(); } public boolean isValid() { if (isBetween()) { return getFrom().compareTo(getTo()) <= 0; } return true; } }
網(wǎng)頁名稱:Spring中如何定義Range范圍對象-創(chuàng)新互聯(lián)
文章源于:http://jinyejixie.com/article12/dhddgc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供電子商務(wù)、網(wǎng)站設(shè)計公司、網(wǎng)站內(nèi)鏈、網(wǎng)站收錄、網(wǎng)站排名、虛擬主機(jī)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容