Java 类com.intellij.util.xml.NamedEnumUtil 实例源码

项目:consulo-javaee    文件:HttpErrorCodeConverter.java   
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;
}
项目:intellij-ce-playground    文件:FormatConverter.java   
@Override
protected AttributeFormat convertString(@Nullable String string, ConvertContext context) {
  if (string == null) return null;
  return NamedEnumUtil.getEnumElementByValue(AttributeFormat.class, StringUtil.capitalize(string));
}
项目:consulo-javaee    文件:HttpErrorCodeConverter.java   
public final String toString(final HttpErrorCode errorCode, final ConvertContext context) {
  return errorCode == null ? null : NamedEnumUtil.getEnumValueByElement(errorCode);
}