tech.simter.genson.ext.data.PageConverterFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of simter-genson-ext Show documentation
Show all versions of simter-genson-ext Show documentation
Simter Genson Extension For Java8 DataTime
package tech.simter.genson.ext.data;
import com.owlike.genson.Converter;
import com.owlike.genson.Factory;
import com.owlike.genson.Genson;
import tech.simter.data.Page;
import javax.inject.Named;
import javax.inject.Singleton;
import java.lang.reflect.Type;
/**
* Register all Page instance to use the common PageConverter.
*
* @author RJ
*/
@Named
@Singleton
public class PageConverterFactory implements Factory> {
private PageConverter pageConverter;
@Override
public Converter create(Type type, Genson genson) {
if (pageConverter == null) pageConverter = new PageConverter();
return pageConverter;
}
}