diff --git a/src/main/java/no/nibio/vips/util/DateMap.java b/src/main/java/no/nibio/vips/util/DateMap.java index eaad3b1a688a06baad2492cc7341fec18dba669d..9dc50863484dae44e07994299d691dd0f8399f03 100644 --- a/src/main/java/no/nibio/vips/util/DateMap.java +++ b/src/main/java/no/nibio/vips/util/DateMap.java @@ -131,8 +131,60 @@ public class DateMap { { return (Integer) this.getParamValueForDate(date, paramName); } - catch(NullPointerException ex) {return null; } - catch(ClassCastException npe) {return null;} + catch(NullPointerException | ClassCastException ex) {return null; } + } + + /** + * Set a parameter value of type Long for a given date + * @param date + * @param paramName + * @param value + */ + public void setParamLongValueForDate(Date date, String paramName, Long value) + { + this.setParamValueForDate(date, paramName, value); + } + + /** + * + * @param date + * @param paramName + * @return a parameter value of type Long for a given date + */ + public Long getParamLongValueForDate(Date date, String paramName) + { + try + { + return (Long) this.getParamValueForDate(date, paramName); + } + catch(NullPointerException | ClassCastException ex) {return null; } + } + + /** + * Set a parameter value of type Date for a given date + * @param date + * @param paramName + * @param value + */ + public void setParamDateValueForDate(Date date, String paramName, Date value) + { + this.setParamLongValueForDate(date, paramName, value.getTime()); + } + + /** + * + * @param date + * @param paramName + * @return a parameter value of type Date for a given date + */ + public Date getParamDateValueForDate(Date date, String paramName) + { + try + { + Long dateVal = this.getParamLongValueForDate(date, paramName); + return new Date(dateVal); + } + catch(NullPointerException | ClassCastException ex) {return null; } } /**