springmvc 这个方法的用法谁懂

public static final T getModelMapObject(Class type, String modelMapAttrKey, HttpServletRequest request, ModelMap modelMap, T defaultValue) {
T modelMapAttrValue = defaultValue;

    if (null != type && null != modelMapAttrKey) {
        Object modelMapAttrValueObject = null;

        if (null != modelMap) {
            modelMapAttrValueObject = modelMap.get(modelMapAttrKey);
        } // if (null != modelMap)

        if (null == modelMapAttrValueObject && null != request) {
            modelMapAttrValueObject = request.getAttribute(modelMapAttrKey);
            if (null != modelMapAttrValueObject && null != modelMap) {
                modelMap.addAttribute(modelMapAttrKey, modelMapAttrValueObject);
            } // if (null != modelMapAttrValueObject && null != modelMap)
        } // if (null == modelMapAttrValueObject && null != request)

        if (null != modelMapAttrValueObject) {
            if (modelMapAttrValueObject.getClass() == type) {
                modelMapAttrValue = (T) modelMapAttrValueObject;
            } else {
                if (Boolean.class == type && modelMapAttrValueObject instanceof Integer) {
                    if (1 == (Integer) modelMapAttrValueObject) {
                        modelMapAttrValue = (T) new Boolean(true);
                    } else {
                        modelMapAttrValue = (T) new Boolean(false);
                    }
                } else if (Map.class == type && modelMapAttrValueObject instanceof Map) {
                    modelMapAttrValue = (T) modelMapAttrValueObject;
                } else if (List.class == type && modelMapAttrValueObject instanceof List) {
                    modelMapAttrValue = (T) modelMapAttrValueObject;
                }
            }
        } // if (null != modelMapAttrValueObject)
    } // if (null != type && null != modelMapAttrKey)

    return modelMapAttrValue;
}

https://blog.csdn.net/snowpage/article/details/47143551