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.test.converters;
12  
13  import org.csveed.bean.conversion.AbstractConverter;
14  import org.csveed.test.model.BeanSimple;
15  
16  /**
17   * The Class BeanSimpleConverter.
18   */
19  public class BeanSimpleConverter extends AbstractConverter<BeanSimple> {
20  
21      /**
22       * Instantiates a new bean simple converter.
23       */
24      public BeanSimpleConverter() {
25          super(BeanSimple.class);
26      }
27  
28      @Override
29      public BeanSimple fromString(String text) throws Exception {
30          BeanSimple bean = new BeanSimple();
31          bean.setName(text);
32          return bean;
33      }
34  
35      @Override
36      public String toString(BeanSimple value) throws Exception {
37          return value.getName();
38      }
39  
40  }