1 /*
2 * CSVeed (https://github.com/42BV/CSVeed)
3 *
4 * Copyright 2013-2023 CSVeed.
5 *
6 * All rights reserved. This program and the accompanying materials
7 * are made available under the terms of The Apache Software License,
8 * Version 2.0 which accompanies this distribution, and is available at
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 */
11 package org.csveed.bean.conversion;
12
13 import java.util.Currency;
14
15 /**
16 * The Class CurrencyConverter.
17 */
18 public class CurrencyConverter extends AbstractConverter<Currency> {
19
20 /**
21 * Instantiates a new currency converter.
22 */
23 public CurrencyConverter() {
24 super(Currency.class);
25 }
26
27 @Override
28 public Currency fromString(String text) {
29 return Currency.getInstance(text);
30 }
31
32 @Override
33 public String toString(Currency value) {
34 return value != null ? value.getCurrencyCode() : "";
35 }
36
37 }