Skip to content

Instantly share code, notes, and snippets.

@debop
Created May 2, 2013 15:08
Show Gist options
  • Select an option

  • Save debop/5502867 to your computer and use it in GitHub Desktop.

Select an option

Save debop/5502867 to your computer and use it in GitHub Desktop.
Between
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