private static <T> Map<String, T> getConstantFieldMap(Iterable<Field> iterable) {
        return Streams
                .stream(iterable)
                .collect(toImmutableMap(Field::getName, field -> {
                    try {
                        @SuppressWarnings("unchecked")
                        final T cast = (T) field.get(null);
                        return cast;
                    } catch (Exception ex) {
                        throw new RuntimeException(ex);
                    }
                }));
    }
Test sync with MediaType and MediaTypeNames.
core/src/test/java/com/linecorp/armeria/common/MediaTypeNamesTest.java