模糊匹配转换为枚举，给定一个值，匹配枚举中定义的所有字段名（包括name属性），一旦匹配到返回这个枚举对象，否则返回null

@param enumClass 枚举类
@param value 值
@return 匹配到的枚举对象，未匹配到返回null
348617
@SuppressWarnings("unchecked")
	public static <T extends Enum<T>> T likeValueOf(Class<T> enumClass, Object value) {
		if(value instanceof CharSequence) {
			value = value.toString().trim();
		}
		
		final Field[] fields = ReflectUtil.getFields(enumClass);
		final Enum<?>[] enums = enumClass.getEnumConstants();
		String fieldName;
		for (Field field : fields) {
			fieldName = field.getName();
			if (field.getType().isEnum() || "ENUM$VALUES".equals(fieldName) || "ordinal".equals(fieldName)) {
				//跳过一些特殊字段
				continue;
			}
			for (Enum<?> enumObj : enums) {
				if(ObjectUtil.equal(value, ReflectUtil.getFieldValue(enumObj, field))) {
					return (T) enumObj;
				}
			}
		}
		return null;
	}
101566
public <T extends Enum<T>> Optional<T> getEnum(String key, Class<T> clazz) {
    return this.get(key).map(value -> asEnumValue(key, value, clazz));
  }
1304798
public <T extends Enum<T>> void setEnum(String name, T value) {
		set(name, value.toString());
	}
433109
public <TEnum extends Enum<TEnum>> TEnum getEnum(String key, Class<TEnum> enumClass)
    {
        return getEnum(key, enumClass, null);
    }
1089415
public static <T extends Enum<T>> T fromString(Class<T> enumClass, String value) {
		return Enum.valueOf(enumClass, value);
	}
1368298
@SuppressWarnings("unchecked")
    private static Enum parseEnum(final String value) {
        final int idx = value.lastIndexOf('.');
        try {
            final Class type = Class.forName(value.substring(0, idx));
            if (!type.isEnum()) {
                throw new IllegalStateException("Type " + type.getName() + " is not enum");
            }
            return Enum.valueOf(type, value.substring(idx + 1));
        } catch (Exception ex) {
            throw new IllegalStateException("Failed to recognize enum value: " + value, ex);
        }
    }
460093
public static String getClassFieldNameWithValue(Class clazz, Object value) {
		Field[] fields = clazz.getFields();
		for (int i = 0; i < fields.length; i++) {
			Field field = fields[i];
			try {
				Object constant = field.get(null);
				if (value.equals(constant)) {
					return clazz.getName() + "." + field.getName();
				}
			}
			catch (Exception e) {
				e.printStackTrace();
			}
		}
		return null;
	}
1278298
public function normalize(string $enumClass, $value, bool $isConvertToLowercase = true): ?string
    {
        if ($isConvertToLowercase && is_string($value)) {
            $value = mb_strtolower($value);
        }

        $enum = $this->enumRegistry->getEnum($enumClass, EnumRegistry::TYPE_COMBINE_NORMALIZE);

        return $enum[$value] ?? null;
    }
969634
public Object getEnumValue(String name) {
		if (this.kind != Kind.ENUM)
			throw new RuntimeException("getEnumValue(..) can only be called on an enum");
		Object[] vals = getEnumValues();
		if (vals != null) {
			for (Object val : vals) {
				if (((Enum<?>)val).name().equals(name))
					return val;
			}
		}
		return null;
	}
926328
public static FieldInfo of(Enum<?> enumValue) {
    try {
      FieldInfo result = FieldInfo.of(enumValue.getClass().getField(enumValue.name()));
      Preconditions.checkArgument(
          result != null, "enum constant missing @Value or @NullValue annotation: %s", enumValue);
      return result;
    } catch (NoSuchFieldException e) {
      // not possible
      throw new RuntimeException(e);
    }
  }
813535
public static List<String> getNames(Class<? extends Enum<?>> clazz) {
		final Enum<?>[] enums = clazz.getEnumConstants();
		if (null == enums) {
			return null;
		}
		final List<String> list = new ArrayList<>(enums.length);
		for (Enum<?> e : enums) {
			list.add(e.name());
		}
		return list;
	}
1370524
@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	public XAnnotationValue<Enum<?>> visit(FieldAccessExpr n, Void arg) {
		try {
			final Class<? extends Enum> enumClass = (Class<? extends Enum>) this.targetClass;
			return new XEnumAnnotationValue(Enum.valueOf(enumClass,
					n.getField()));
		} catch (Exception ex) {
			// BUG
			throw new RuntimeException(ex);
		}
	}
86029
@Override
	public T convert(String name) throws IllegalArgumentException {
		if (name == null) {
			throw new IllegalArgumentException("Cant convert 'null' to " + enumClass.getSimpleName());
		}
		try {
			return Enum.valueOf(enumClass, name);
		} catch (IllegalArgumentException e) {
			// ignore
		}
		try {
			return Enum.valueOf(enumClass, name.toUpperCase());
		} catch (IllegalArgumentException e) {
			// ignore
		}
		try {
			return Enum.valueOf(enumClass, name.toUpperCase().replace("-", "_"));
		} catch (IllegalArgumentException e) {
			// ignore
		}
		throw new IllegalArgumentException("Can't convert " + name + " to " + enumClass.getSimpleName());

	}
1020597
public static String enumValues(Class<?> enumClass) {
    Preconditions.checkNotNull(enumClass, "enumClass cannot be null");
    Preconditions.checkState(enumClass.isEnum(), "enumClass must be an enum.");
    return Joiner.on(", ").join(enumClass.getEnumConstants());
  }
1070067
public <T extends Enum<T>> T readEnum(Class<T> enumType) throws IOException {
		try {
			return Enum.valueOf(enumType, readUTF());
		} catch(IllegalArgumentException err) {
			throw new IOException(err);
		}
	}
1007719
public static <T extends Enum<T>> Optional<T> asEnumValue(Class<T> clazz, Attribute a) {
    class Visitor extends SimpleAnnotationValueVisitor8<T, Void> {
      @Override
      public T visitEnumConstant(VariableElement c, Void unused) {
        return Enum.valueOf(clazz, c.getSimpleName().toString());
      }
    }
    return Optional.ofNullable(a.accept(new Visitor(), null));
  }
333745
public <T> T convert(Object value, Class<T> clazz) {
    if (null == value) return null;
    if (value instanceof String && Strings.isEmpty((String) value)) { return null; }
    if (value.getClass().isArray()) {
      Object[] values = (Object[]) value;
      if (values.length >= 1) {
        value = values[0];
      }
    }
    return conversion.convert(value, clazz);
  }