View Javadoc
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.TimeZone;
14  
15  /**
16   * The Class TimeZoneConverter.
17   */
18  public class TimeZoneConverter extends AbstractConverter<TimeZone> {
19  
20      /**
21       * Instantiates a new time zone converter.
22       */
23      public TimeZoneConverter() {
24          super(TimeZone.class);
25      }
26  
27      @Override
28      public TimeZone fromString(String text) throws Exception {
29          return TimeZone.getTimeZone(text);
30      }
31  
32      @Override
33      public String toString(TimeZone value) throws Exception {
34          return value.getDisplayName();
35      }
36  }