protected <V> V getValFromMap(Map<String, Object> headers, String name, Class<V> type) { Object value = headers.get(name); if (value == null) { return null; } if (!type.isAssignableFrom(value.getClass())) { if (logger.isWarnEnabled()) { logger.warn("Skipping header ‘" + name + "‘expected type [" + type + "], but got [" + value.getClass() + "]"); } return null; } else { return type.cast(value); } }
原文地址:https://www.cnblogs.com/nizuimeiabc1/p/9605452.html
时间: 2024-10-14 02:00:02