Here you can find the source of getEnum(ResultSet r, String columnName, Class
public static <T extends Enum<T>> T getEnum(ResultSet r, String columnName, Class<T> enumType) throws SQLException
//package com.java2s; //License from project: Apache License import java.sql.ResultSet; import java.sql.SQLException; public class Main { public static <T extends Enum<T>> T getEnum(ResultSet r, String columnName, Class<T> enumType) throws SQLException { String name = r.getString(columnName); T val = null; if (name != null) { try { val = Enum.valueOf(enumType, name); } catch (java.lang.IllegalArgumentException e) { val = null; }/*from www . j a v a 2 s . co m*/ } return val; } }