Jsr310DateTimeFormatAnnotationFormatterFactory.java (spring-framework-5.3.23) | : | Jsr310DateTimeFormatAnnotationFormatterFactory.java (spring-framework-5.3.24) | ||
---|---|---|---|---|
/* | /* | |||
* Copyright 2002-2021 the original author or authors. | * Copyright 2002-2022 the original author or authors. | |||
* | * | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | * You may obtain a copy of the License at | |||
* | * | |||
* https://www.apache.org/licenses/LICENSE-2.0 | * https://www.apache.org/licenses/LICENSE-2.0 | |||
* | * | |||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | * distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
skipping to change at line 98 | skipping to change at line 98 | |||
formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME ; | formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME ; | |||
} | } | |||
} | } | |||
return new TemporalAccessorPrinter(formatter); | return new TemporalAccessorPrinter(formatter); | |||
} | } | |||
@Override | @Override | |||
@SuppressWarnings("unchecked") | @SuppressWarnings("unchecked") | |||
public Parser<?> getParser(DateTimeFormat annotation, Class<?> fieldType) { | public Parser<?> getParser(DateTimeFormat annotation, Class<?> fieldType) { | |||
DateTimeFormatter formatter = getFormatter(annotation, fieldType) | ||||
; | ||||
List<String> resolvedFallbackPatterns = new ArrayList<>(); | List<String> resolvedFallbackPatterns = new ArrayList<>(); | |||
for (String fallbackPattern : annotation.fallbackPatterns()) { | for (String fallbackPattern : annotation.fallbackPatterns()) { | |||
String resolvedFallbackPattern = resolveEmbeddedValue(fal lbackPattern); | String resolvedFallbackPattern = resolveEmbeddedValue(fal lbackPattern); | |||
if (StringUtils.hasLength(resolvedFallbackPattern)) { | if (StringUtils.hasLength(resolvedFallbackPattern)) { | |||
resolvedFallbackPatterns.add(resolvedFallbackPatt ern); | resolvedFallbackPatterns.add(resolvedFallbackPatt ern); | |||
} | } | |||
} | } | |||
DateTimeFormatter formatter = getFormatter(annotation, fieldType) ; | ||||
return new TemporalAccessorParser((Class<? extends TemporalAccess or>) fieldType, | return new TemporalAccessorParser((Class<? extends TemporalAccess or>) fieldType, | |||
formatter, resolvedFallbackPatterns.toArray(new S tring[0]), annotation); | formatter, resolvedFallbackPatterns.toArray(new S tring[0]), annotation); | |||
} | } | |||
/** | /** | |||
* Factory method used to create a {@link DateTimeFormatter}. | * Factory method used to create a {@link DateTimeFormatter}. | |||
* @param annotation the format annotation for the field | * @param annotation the format annotation for the field | |||
* @param fieldType the declared type of the field | * @param fieldType the declared type of the field | |||
* @return a {@link DateTimeFormatter} instance | * @return a {@link DateTimeFormatter} instance | |||
*/ | */ | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 4 lines changed or added |