Add millis methods to DateClientParam, #1798

This commit is contained in:
David Gileadi 2020-04-10 14:20:11 -07:00 committed by James Agnew
parent bcac2b061c
commit 37dcf589de
1 changed files with 22 additions and 4 deletions

View File

@ -137,7 +137,7 @@ public class DateClientParam extends BaseClientParam implements IParam {
myPrefix = thePrefix;
this.previous = previous;
}
public DateWithPrefix(ParamPrefixEnum thePrefix) {
myPrefix = thePrefix;
}
@ -176,13 +176,27 @@ public class DateClientParam extends BaseClientParam implements IParam {
dt.setPrecision(TemporalPrecisionEnum.SECOND);
return constructCriterion(dt);
}
@Override
public IDateCriterion millis(Date theValue) {
DateTimeDt dt = new DateTimeDt(theValue);
dt.setPrecision(TemporalPrecisionEnum.MILLI);
return constructCriterion(dt);
}
@Override
public IDateCriterion millis(String theValue) {
DateTimeDt dt = new DateTimeDt(theValue);
dt.setPrecision(TemporalPrecisionEnum.MILLI);
return constructCriterion(dt);
}
private IDateCriterion constructCriterion(DateTimeDt dt) {
String valueAsString = dt.getValueAsString();
Criterion criterion = new Criterion(myPrefix, valueAsString);
if (previous != null) {
criterion.orCriterion = previous;
}
}
return criterion;
}
}
@ -199,8 +213,12 @@ public class DateClientParam extends BaseClientParam implements IParam {
IDateCriterion second(String theValue);
IDateCriterion millis(Date theValue);
IDateCriterion millis(String theValue);
}
public interface IDateCriterion extends ICriterion<DateClientParam> {
IDateSpecifier orAfter();