|
| 1 | +/* |
| 2 | + * Copyright © 2019 Dominokit |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package org.dominokit.domino.ui.forms; |
| 17 | + |
| 18 | +import java.util.Date; |
| 19 | +import java.util.Objects; |
| 20 | + |
| 21 | +public class DateRange { |
| 22 | + |
| 23 | + private final Date from; |
| 24 | + private final Date to; |
| 25 | + |
| 26 | + public DateRange() { |
| 27 | + this(new Date(), new Date()); |
| 28 | + } |
| 29 | + |
| 30 | + public DateRange(Date from, Date to) { |
| 31 | + Objects.requireNonNull(from); |
| 32 | + Objects.requireNonNull(to); |
| 33 | + this.from = from; |
| 34 | + this.to = to; |
| 35 | + } |
| 36 | + |
| 37 | + public Date getFrom() { |
| 38 | + return from; |
| 39 | + } |
| 40 | + |
| 41 | + public Date getTo() { |
| 42 | + return to; |
| 43 | + } |
| 44 | + |
| 45 | + @Override |
| 46 | + public boolean equals(Object o) { |
| 47 | + if (this == o) { |
| 48 | + return true; |
| 49 | + } |
| 50 | + if (o == null || getClass() != o.getClass()) { |
| 51 | + return false; |
| 52 | + } |
| 53 | + DateRange dateRange = (DateRange) o; |
| 54 | + return Objects.equals(from, dateRange.from) && Objects.equals(to, dateRange.to); |
| 55 | + } |
| 56 | + |
| 57 | + @Override |
| 58 | + public int hashCode() { |
| 59 | + return Objects.hash(from, to); |
| 60 | + } |
| 61 | +} |
0 commit comments