/** * Sets a header parameter with the specified key and value. * * <p>If the key matches one of the reserved header parameter names, then the relevant * <tt>set</tt> method is called to set that header parameter with the specified value. * * @param key The key of the header parameter. * @param value The value of the header parameter. */ public void setParameter(String key, Object value) { JwtHeaderKey headerKey = getHeaderKey(key.toUpperCase()); switch (headerKey) { case TYP: { if (isValueOfType(value, JwtType.class)) { setType((JwtType) value); } else { checkValueIsOfType(value, String.class); setType(JwtType.jwtType((String) value)); } break; } case ALG: { if (isValueOfType(value, Algorithm.class)) { setAlgorithm((Algorithm) value); } else { checkValueIsOfType(value, String.class); put(ALG.value(), value); } break; } default: { put(key, value); } } }