Created
May 2, 2013 15:08
-
-
Save debop/5502867 to your computer and use it in GitHub Desktop.
Between
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static Criterion getIsBetweenCriterion(String propertyName, Object lo, Object hi, | |
| boolean includeLo, boolean includeHi) { | |
| shouldNotBeEmpty(propertyName, "propertyName"); | |
| if (lo == null && hi == null) | |
| throw new IllegalArgumentException("상하한 값 모두 null 이면 안됩니다."); | |
| if (lo != null && hi != null && includeLo && includeHi) | |
| return between(propertyName, lo, hi); | |
| // lo, hi 값 중 하나가 없다면 | |
| Conjunction result = conjunction(); | |
| if (lo != null) | |
| result.add((includeLo) ? ge(propertyName, lo) | |
| : gt(propertyName, lo)); | |
| if (hi != null) | |
| result.add((includeHi) ? le(propertyName, hi) | |
| : lt(propertyName, hi)); | |
| return result; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment