@@ -81,24 +81,24 @@ public final class DateProcessor extends AbstractProcessor {
81
81
for (String format : formats ) {
82
82
DateFormat dateFormat = DateFormat .fromString (format );
83
83
dateParsers .add ((params ) -> {
84
- var documentZoneId = newDateTimeZone (params );
85
- var documentLocale = newLocale (params );
84
+ var documentTimezone = timezone == null ? null : timezone . newInstance (params ). execute ( );
85
+ var documentLocale = locale == null ? null : locale . newInstance (params ). execute ( );
86
86
return Cache .INSTANCE .getOrCompute (
87
- new Cache .Key (format , documentZoneId , documentLocale ),
88
- () -> dateFormat .getFunction (format , documentZoneId , documentLocale )
87
+ new Cache .Key (format , documentTimezone , documentLocale ),
88
+ () -> dateFormat .getFunction (format , newDateTimeZone ( documentTimezone ), newLocale ( documentLocale ) )
89
89
);
90
90
});
91
91
}
92
92
this .outputFormat = outputFormat ;
93
93
formatter = DateFormatter .forPattern (this .outputFormat );
94
94
}
95
95
96
- private ZoneId newDateTimeZone (Map < String , Object > params ) {
97
- return timezone == null ? ZoneOffset .UTC : ZoneId .of (timezone . newInstance ( params ). execute () );
96
+ private static ZoneId newDateTimeZone (String timezone ) {
97
+ return timezone == null ? ZoneOffset .UTC : ZoneId .of (timezone );
98
98
}
99
99
100
- private Locale newLocale (Map < String , Object > params ) {
101
- return locale == null ? Locale .ROOT : LocaleUtils .parse (locale . newInstance ( params ). execute () );
100
+ private static Locale newLocale (String locale ) {
101
+ return locale == null ? Locale .ROOT : LocaleUtils .parse (locale );
102
102
}
103
103
104
104
@ Override
@@ -255,6 +255,6 @@ Function<String, ZonedDateTime> getOrCompute(Key key, Supplier<Function<String,
255
255
return fn ;
256
256
}
257
257
258
- record Key (String format , ZoneId zoneId , Locale locale ) {}
258
+ record Key (String format , String zoneId , String locale ) {}
259
259
}
260
260
}
0 commit comments