1111import java .util .HashMap ;
1212import java .util .Map ;
1313
14- import static com .relogiclabs .jschema .message .ErrorCode .AMPMVD01 ;
14+ import static com .relogiclabs .jschema .message .ErrorCode .AMPMMS01 ;
1515import static com .relogiclabs .jschema .message .ErrorCode .CNFLDT01 ;
16- import static com .relogiclabs .jschema .message .ErrorCode .DAYVDF01 ;
17- import static com .relogiclabs .jschema .message .ErrorCode .DAYVDF02 ;
18- import static com .relogiclabs .jschema .message .ErrorCode .ERAVDF01 ;
19- import static com .relogiclabs .jschema .message .ErrorCode .HURVDF01 ;
20- import static com .relogiclabs .jschema .message .ErrorCode .HURVDF02 ;
21- import static com .relogiclabs .jschema .message .ErrorCode .HURVDF03 ;
22- import static com .relogiclabs .jschema .message .ErrorCode .HURVDF04 ;
16+ import static com .relogiclabs .jschema .message .ErrorCode .DAYRNG01 ;
17+ import static com .relogiclabs .jschema .message .ErrorCode .DAYRNG02 ;
18+ import static com .relogiclabs .jschema .message .ErrorCode .ERANMS01 ;
19+ import static com .relogiclabs .jschema .message .ErrorCode .HURRNG01 ;
20+ import static com .relogiclabs .jschema .message .ErrorCode .HURRNG02 ;
21+ import static com .relogiclabs .jschema .message .ErrorCode .HURRNG03 ;
22+ import static com .relogiclabs .jschema .message .ErrorCode .HURRNG04 ;
2323import static com .relogiclabs .jschema .message .ErrorCode .INVLDT02 ;
24- import static com .relogiclabs .jschema .message .ErrorCode .MNTVDF01 ;
25- import static com .relogiclabs .jschema .message .ErrorCode .MONVDF01 ;
26- import static com .relogiclabs .jschema .message .ErrorCode .SECVDF01 ;
27- import static com .relogiclabs .jschema .message .ErrorCode .UTCVDF01 ;
28- import static com .relogiclabs .jschema .message .ErrorCode .UTCVDF02 ;
29- import static com .relogiclabs .jschema .message .ErrorCode .WEKVDF01 ;
30- import static com .relogiclabs .jschema .message .ErrorCode .YARVDF01 ;
24+ import static com .relogiclabs .jschema .message .ErrorCode .MNTRNG01 ;
25+ import static com .relogiclabs .jschema .message .ErrorCode .MONRNG01 ;
26+ import static com .relogiclabs .jschema .message .ErrorCode .SECRNG01 ;
27+ import static com .relogiclabs .jschema .message .ErrorCode .UTCRNG01 ;
28+ import static com .relogiclabs .jschema .message .ErrorCode .UTCRNG02 ;
29+ import static com .relogiclabs .jschema .message .ErrorCode .WEKDMS01 ;
30+ import static com .relogiclabs .jschema .message .ErrorCode .YARRNG01 ;
3131import static com .relogiclabs .jschema .time .JsonDateTime .UNSET ;
3232import static java .time .DayOfWeek .FRIDAY ;
3333import static java .time .DayOfWeek .MONDAY ;
@@ -105,13 +105,13 @@ public void setEra(String era) {
105105 var eraNum = switch (era .toUpperCase ()) {
106106 case "BC" -> 1 ;
107107 case "AD" -> 2 ;
108- default -> throw failOnInvalidDateTime (ERAVDF01 , "era input" );
108+ default -> throw failOnInvalidDateTime (ERANMS01 , "era input" );
109109 };
110110 this .era = checkField (this .era , eraNum );
111111 }
112112
113113 public void setYear (int year , int digitNum ) {
114- if (year < 1 || year > 9999 ) throw failOnInvalidDateTime (YARVDF01 , "year out of range" );
114+ if (year < 1 || year > 9999 ) throw failOnInvalidDateTime (YARRNG01 , "year out of range" );
115115 year = digitNum <= 2 ? toFourDigitYear (year ) : year ;
116116 this .year = checkField (this .year , year );
117117 }
@@ -122,7 +122,7 @@ public void setMonth(String month) {
122122 }
123123
124124 public void setMonth (int month ) {
125- if (month < 1 || month > 12 ) throw failOnInvalidDateTime (MONVDF01 , "month out of range" );
125+ if (month < 1 || month > 12 ) throw failOnInvalidDateTime (MONRNG01 , "month out of range" );
126126 this .month = checkField (this .month , month );
127127 }
128128
@@ -132,36 +132,36 @@ public void setWeekday(String weekday) {
132132 }
133133
134134 public void setDay (int day ) {
135- if (day < 1 || day > 31 ) throw failOnInvalidDateTime (DAYVDF01 , "day out of range" );
135+ if (day < 1 || day > 31 ) throw failOnInvalidDateTime (DAYRNG01 , "day out of range" );
136136 this .day = checkField (this .day , day );
137137 }
138138
139139 public void setAmPm (String amPm ) {
140140 var amPmNum = switch (amPm .toLowerCase ()) {
141141 case "am" -> 1 ;
142142 case "pm" -> 2 ;
143- default -> throw failOnInvalidDateTime (AMPMVD01 , "hour AM/PM input" );
143+ default -> throw failOnInvalidDateTime (AMPMMS01 , "hour AM/PM input" );
144144 };
145145 if (hour != UNSET && (hour < 1 || hour > 12 ))
146- throw failOnInvalidDateTime (HURVDF01 , "hour out of range for AM/PM" );
146+ throw failOnInvalidDateTime (HURRNG01 , "hour out of range for AM/PM" );
147147 this .amPm = checkField (this .amPm , amPmNum );
148148 }
149149
150150 public void setHour (int hour ) {
151151 if (amPm != UNSET && (this .hour < 1 || this .hour > 12 ))
152- throw failOnInvalidDateTime (HURVDF02 , "hour out of range for AM/PM" );
152+ throw failOnInvalidDateTime (HURRNG02 , "hour out of range for AM/PM" );
153153 if (hour < 0 || hour > 23 )
154- throw failOnInvalidDateTime (HURVDF03 , "hour out of range" );
154+ throw failOnInvalidDateTime (HURRNG03 , "hour out of range" );
155155 this .hour = checkField (this .hour , hour );
156156 }
157157
158158 public void setMinute (int minute ) {
159- if (minute < 0 || minute > 59 ) throw failOnInvalidDateTime (MNTVDF01 , "minute out of range" );
159+ if (minute < 0 || minute > 59 ) throw failOnInvalidDateTime (MNTRNG01 , "minute out of range" );
160160 this .minute = checkField (this .minute , minute );
161161 }
162162
163163 public void setSecond (int second ) {
164- if (second < 0 || second > 59 ) throw failOnInvalidDateTime (SECVDF01 , "second out of range" );
164+ if (second < 0 || second > 59 ) throw failOnInvalidDateTime (SECRNG01 , "second out of range" );
165165 this .second = checkField (this .second , second );
166166 }
167167
@@ -170,9 +170,9 @@ public void setFraction(int fraction) {
170170 }
171171
172172 public void setUtcOffset (int hour , int minute ) {
173- if (hour < -12 || hour > 12 ) throw failOnInvalidDateTime (UTCVDF01 ,
173+ if (hour < -12 || hour > 12 ) throw failOnInvalidDateTime (UTCRNG01 ,
174174 "UTC offset hour out of range" );
175- if (minute < 0 || minute > 59 ) throw failOnInvalidDateTime (UTCVDF02 ,
175+ if (minute < 0 || minute > 59 ) throw failOnInvalidDateTime (UTCRNG02 ,
176176 "UTC offset minute out of range" );
177177 utcHour = checkField (utcHour , hour );
178178 utcMinute = checkField (utcMinute , minute );
@@ -194,14 +194,14 @@ public JsonDateTime validate() {
194194 if (isAllSet (year , month , day )) {
195195 DAYS_IN_MONTH [2 ] = isLeapYear (year )? 29 : 28 ;
196196 if (day < 1 || day > DAYS_IN_MONTH [month ])
197- throw failOnInvalidDateTime (DAYVDF02 , "day out of range" );
197+ throw failOnInvalidDateTime (DAYRNG02 , "day out of range" );
198198 dateTime = new JsonDateTime (type , year , month , day );
199199 if (weekday != UNSET && dateTime .getDayOfWeek ().getValue () != weekday )
200- throw failOnInvalidDateTime (WEKVDF01 , "weekday not matched" );
200+ throw failOnInvalidDateTime (WEKDMS01 , "weekday not matched" );
201201 }
202202 if (isAllSet (hour , amPm )) convertTo24Hour ();
203203 if (hour != UNSET && (hour < 0 || hour > 23 ))
204- throw failOnInvalidDateTime (HURVDF04 , "hour out of range" );
204+ throw failOnInvalidDateTime (HURRNG04 , "hour out of range" );
205205 return new JsonDateTime (type , year , month , day , hour , minute , second ,
206206 fraction , new JsonUtcOffset (utcHour , utcMinute ));
207207 } catch (InvalidDateTimeException e ) {
0 commit comments