All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.konik.csv.converter.LanguageCodeConverter Maven / Gradle / Ivy

The newest version!
package io.konik.csv.converter;

import org.dozer.DozerConverter;

import com.neovisionaries.i18n.LanguageCode;

/**
 * Intermediate converter used to convert {@link String} to {@link LanguageCode}
 * while mapping a single value to a collection using custom add..() method.
 */
public class LanguageCodeConverter extends DozerConverter {

   public LanguageCodeConverter() {
      this(String.class, LanguageCode.class);
   }

   public LanguageCodeConverter(Class prototypeA, Class prototypeB) {
      super(prototypeA, prototypeB);
   }

   @Override
   public LanguageCode convertTo(String source, LanguageCode destination) {
      return LanguageCode.getByCode(source, false);
   }

   @Override
   public String convertFrom(LanguageCode source, String destination) {
      return source.toString();
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy