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  /**
14   * Stateless converter from String to Object.
15   *
16   * @param <K>
17   *            the Object to convert the String to
18   */
19  public interface Converter<K> {
20  
21      /**
22       * From string.
23       *
24       * @param text
25       *            the text
26       *
27       * @return the k
28       *
29       * @throws Exception
30       *             the exception
31       */
32      K fromString(String text) throws Exception;
33  
34      /**
35       * To string.
36       *
37       * @param value
38       *            the value
39       *
40       * @return the string
41       *
42       * @throws Exception
43       *             the exception
44       */
45      String toString(K value) throws Exception;
46  
47      /**
48       * Info on type.
49       *
50       * @return the string
51       */
52      String infoOnType();
53  
54      /**
55       * Gets the type.
56       *
57       * @return the type
58       */
59      Class<K> getType();
60  
61  }