From 22e056fa4ead231eb804d3cea02dd098b75c30fb Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 7 Apr 2016 12:34:21 +0200 Subject: [PATCH] added constructors and made endTime/startTime not nullable --- .../opening_times/BusinessOpeningTimes.java | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/src/org/mxchange/jcontactsbusiness/opening_times/BusinessOpeningTimes.java b/src/org/mxchange/jcontactsbusiness/opening_times/BusinessOpeningTimes.java index bffed5d..f11ea40 100644 --- a/src/org/mxchange/jcontactsbusiness/opening_times/BusinessOpeningTimes.java +++ b/src/org/mxchange/jcontactsbusiness/opening_times/BusinessOpeningTimes.java @@ -56,7 +56,7 @@ public class BusinessOpeningTimes implements OpeningTimes { * Ending time (hh:mm) */ @Basic (optional = false) - @Column (name = "opening_times_end_time") + @Column (name = "opening_times_end_time", nullable = false) @Temporal (TemporalType.TIME) private Calendar endTime; @@ -80,10 +80,49 @@ public class BusinessOpeningTimes implements OpeningTimes { * Starting time (hh:mm) */ @Basic (optional = false) - @Column (name = "opening_times_start_time") + @Column (name = "opening_times_start_time", nullable = false) @Temporal (TemporalType.TIME) private Calendar startTime; + /** + * Default constructor + */ + public BusinessOpeningTimes () { + } + + /** + * Constructor with all field + *

+ * @param endDay End day + * @param endTime End time + * @param id Id number + * @param startDay Start day + * @param startTime Start time + */ + public BusinessOpeningTimes (final DayOfWeek endDay, final Calendar endTime, final Long id, final DayOfWeek startDay, final Calendar startTime) { + // Call other constructor + this(endDay, endTime, startDay, startTime); + + // Set id number + this.id = id; + } + + /** + * Constructor with all fields except id number + *

+ * @param endDay End day + * @param endTime End time + * @param startDay Start day + * @param startTime Start time + */ + public BusinessOpeningTimes (final DayOfWeek endDay, final Calendar endTime, final DayOfWeek startDay, final Calendar startTime) { + // Set all fields + this.endDay = endDay; + this.endTime = endTime; + this.startDay = startDay; + this.startTime = startTime; + } + @Override public boolean equals (final Object obj) { if (this == obj) { -- 2.39.5