|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2015 the original author or authors. |
|
|
|
|
* Copyright 2002-2022 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -19,17 +19,22 @@ package org.springframework.core.convert.support;
@@ -19,17 +19,22 @@ package org.springframework.core.convert.support;
|
|
|
|
|
import java.util.Currency; |
|
|
|
|
|
|
|
|
|
import org.springframework.core.convert.converter.Converter; |
|
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Convert a String to a {@link Currency}. |
|
|
|
|
* |
|
|
|
|
* @author Stephane Nicoll |
|
|
|
|
* @author Sam Brannen |
|
|
|
|
* @since 4.2 |
|
|
|
|
*/ |
|
|
|
|
class StringToCurrencyConverter implements Converter<String, Currency> { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Currency convert(String source) { |
|
|
|
|
if (StringUtils.hasText(source)) { |
|
|
|
|
source = source.trim(); |
|
|
|
|
} |
|
|
|
|
return Currency.getInstance(source); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|