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

com.bixuebihui.jdbc.EnumConverter Maven / Gradle / Ivy

Go to download

a fast small database connection pool and a active record flavor mini framework

There is a newer version: 1.15.8.3
Show newest version
package com.bixuebihui.jdbc;

import org.apache.commons.beanutils.Converter;

/**
 * 

EnumConverter class.

* * @author xingwx * @version $Id: $Id */ public class EnumConverter implements Converter { /** * {@inheritDoc} */ @Override public Object convert(@SuppressWarnings("rawtypes") Class type, Object value) { if(value==null) { return null; } if(type.isEnum()) { int v = Integer.parseInt(value.toString()); return type.getEnumConstants()[v]; }else{ System.out.println("WARN: error registed EnumConverter for type:"+type.getCanonicalName()); } return null; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy