@SuppressWarnings({"unchecked", "rawtypes"})
    public Object convert(Class destClass, Object srcObj) {
        if (null == srcObj) {
            MappingUtils.throwMappingException("Cannot convert null to enum of type " + destClass);
        }

        try {
            if ((srcObj.getClass().equals(Byte.class)) || (srcObj.getClass().equals(Byte.TYPE))) {
                return EnumUtils.getEnumList(destClass).get(((Byte)srcObj).intValue());
            } else if ((srcObj.getClass().equals(Short.class)) || (srcObj.getClass().equals(Short.TYPE))) {
                return EnumUtils.getEnumList(destClass).get(((Short)srcObj).intValue());
            } else if ((srcObj.getClass().equals(Integer.class)) || (srcObj.getClass().equals(Integer.TYPE))) {
                return EnumUtils.getEnumList(destClass).get((Integer)srcObj);
            } else if ((srcObj.getClass().equals(Long.class)) || (srcObj.getClass().equals(Long.TYPE))) {
                return EnumUtils.getEnumList(destClass).get(((Long) srcObj).intValue());
            } else if (Enum.class.isAssignableFrom(srcObj.getClass())) {
                return Enum.valueOf(destClass, ((Enum)srcObj).name());
            } else {
                return Enum.valueOf(destClass, srcObj.toString());
            }
        } catch (Exception e) {
            MappingUtils.throwMappingException("Cannot convert [" + srcObj + "] to enum of type " + destClass, e);
        }
        return srcObj;
    }
Internal class for converting Supported Data Types to Enum. Only intended for internal use.
core/src/main/java/com/github/dozermapper/core/converters/EnumConverter.java