|
20 | 20 | import java.util.Arrays; |
21 | 21 |
|
22 | 22 | /** |
23 | | - * Opening hours for a Place Details result. Please see <a |
24 | | - * href="https://developers.google.com/places/web-service/details#PlaceDetailsResults">Place Details |
| 23 | + * Opening hours for a Place Details result. Please see <a href= |
| 24 | + * "https://developers.google.com/places/web-service/details#PlaceDetailsResults">Place Details |
25 | 25 | * Results</a> for more details. |
26 | 26 | */ |
27 | 27 | public class OpeningHours implements Serializable { |
@@ -96,29 +96,68 @@ public String toString() { |
96 | 96 | /** Opening periods covering seven days, starting from Sunday, in chronological order. */ |
97 | 97 | public Period[] periods; |
98 | 98 |
|
| 99 | + /** An indicator of special hours for a Place for a single day. */ |
| 100 | + public static class SpecialDay implements Serializable { |
| 101 | + |
| 102 | + private static final long serialVersionUID = 1L; |
| 103 | + |
| 104 | + /** |
| 105 | + * A date expressed in RFC3339 format in the local timezone for the place, for example |
| 106 | + * 2010-12-31. |
| 107 | + */ |
| 108 | + public String date; |
| 109 | + |
| 110 | + /** |
| 111 | + * True if there are exceptional hours for this day. If true, this means that there is at least |
| 112 | + * one exception for this day. Exceptions cause different values to occur in the subfields of |
| 113 | + * currentOpeningHours and secondaryOpeningHours such as periods, DayOfWeek, openNow. The |
| 114 | + * exceptions apply to the hours, and the hours are used to generate the other fields. |
| 115 | + */ |
| 116 | + public Boolean exceptionalHours; |
| 117 | + |
| 118 | + @Override |
| 119 | + public String toString() { |
| 120 | + StringBuilder sb = new StringBuilder("[Special Day: "); |
| 121 | + if (date != null) { |
| 122 | + sb.append(" (\"").append(date).append("\")"); |
| 123 | + } |
| 124 | + if (exceptionalHours != null) { |
| 125 | + sb.append(" (\"").append(exceptionalHours).append("\")"); |
| 126 | + } |
| 127 | + sb.append("]"); |
| 128 | + return sb.toString(); |
| 129 | + } |
| 130 | + } |
| 131 | + |
| 132 | + /** An array of up to seven entries corresponding to the next seven days. */ |
| 133 | + public SpecialDay[] specialDays; |
| 134 | + |
99 | 135 | /** |
100 | | - * The formatted opening hours for each day of the week, as an array of seven strings; for |
101 | | - * example, {@code "Monday: 8:30 am – 5:30 pm"}. |
| 136 | + * A type string used to identify the type of secondary hours (for example, DRIVE_THROUGH, |
| 137 | + * HAPPY_HOUR, DELIVERY, TAKEOUT, KITCHEN, BREAKFAST, LUNCH, DINNER, BRUNCH, PICKUP, |
| 138 | + * SENIOR_HOURS). Set for secondary_opening_hours only. |
102 | 139 | */ |
103 | | - public String[] weekdayText; |
| 140 | + public String type; |
104 | 141 |
|
105 | 142 | /** |
106 | | - * Indicates that the place has permanently shut down. |
107 | | - * |
108 | | - * <p>Note: this field will be null if it isn't present in the response. |
| 143 | + * The formatted opening hours for each day of the week, as an array of seven strings; for |
| 144 | + * example, {@code "Monday: 8:30 am – 5:30 pm"}. |
109 | 145 | */ |
110 | | - public Boolean permanentlyClosed; |
| 146 | + public String[] weekdayText; |
111 | 147 |
|
112 | 148 | @Override |
113 | 149 | public String toString() { |
114 | 150 | StringBuilder sb = new StringBuilder("[OpeningHours:"); |
115 | | - if (permanentlyClosed != null && permanentlyClosed) { |
116 | | - sb.append(" permanentlyClosed"); |
117 | | - } |
118 | 151 | if (openNow != null && openNow) { |
119 | 152 | sb.append(" openNow"); |
120 | 153 | } |
121 | 154 | sb.append(" ").append(Arrays.toString(periods)); |
| 155 | + if (specialDays != null) { |
| 156 | + sb.append(" (\"").append(specialDays).append("\")"); |
| 157 | + } |
| 158 | + if (type != null) { |
| 159 | + sb.append(" (\"").append(type).append("\")"); |
| 160 | + } |
122 | 161 | return sb.toString(); |
123 | 162 | } |
124 | 163 | } |
0 commit comments