public final HttpErrorCode fromString(final String s, final ConvertContext context) { if (s == null) { return null; } final HttpErrorCode value = NamedEnumUtil.getEnumElementByValue(HttpErrorCode.class, s); if (value != null) { return value; } // allow custom 3-digit (error) codes return HTTP_STATUS_CODE.matcher(s).matches() ? HttpErrorCode.BAD_REQUEST : null; }
@Override protected AttributeFormat convertString(@Nullable String string, ConvertContext context) { if (string == null) return null; return NamedEnumUtil.getEnumElementByValue(AttributeFormat.class, StringUtil.capitalize(string)); }
public final String toString(final HttpErrorCode errorCode, final ConvertContext context) { return errorCode == null ? null : NamedEnumUtil.getEnumValueByElement(errorCode); }