static String toHeaderName(String name) {
        requireNonNull(name, "name");
        checkArgument(!name.isEmpty(), "name is empty.");

        final String upperCased = Ascii.toUpperCase(name);
        if (name.equals(upperCased)) {
            return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name);
        }
        final String lowerCased = Ascii.toLowerCase(name);
        if (name.equals(lowerCased)) {
            return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name);
        }
        // Ensure that the name does not contain '_'.
        // If it contains '_', we give up to make it lower hyphen case. Just converting it to lower case.
        if (name.indexOf('_') >= 0) {
            return lowerCased;
        }
        if (Ascii.isUpperCase(name.charAt(0))) {
            return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, name);
        } else {
            return CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN, name);
        }
    }
Returns the name of the {@link Parameter} or the {@link Field}.
@param element either {@link Parameter} or {@link Field}
core/src/main/java/com/linecorp/armeria/internal/server/annotation/AnnotatedElementNameUtil.java