@@ -49,8 +49,19 @@ public final class {{ my_class_name }} {
4949 {% endif %}
5050 {% endfor %}
5151 // Enum definitions
52- {% for attribute in ctx .attributes | select ("enum" ) | rejectattr ("name" , "in" , ctx .excluded_attributes ) %}
53- {% - if attribute is stable -%}
52+ {% for attribute in ctx .attributes | select ("enum" ) | rejectattr ("name" , "in" , ctx .excluded_attributes ) %}
53+ {% set enum_deprecated_in_favor_of_stable = namespace (value =false ) %}
54+ {% if attribute is stable %}
55+ {% - set enum_deprecated_in_favor_of_stable .value = true -%}
56+ {% - endif -%}
57+ {% - for member in attribute .type .members %}
58+ {% if member is experimental %}
59+ {% if not member is deprecated %}
60+ {% - set enum_deprecated_in_favor_of_stable .value = false -%}
61+ {% - endif -%}
62+ {% - endif -%}
63+ {% - endfor %}
64+ {% - if enum_deprecated_in_favor_of_stable .value -%}
5465 {% - set stable_class_link = "io.opentelemetry.semconv." ~ stable_class_name ~ "." ~ (attribute .name | pascal_case ) ~ "Values" -%}
5566 /**
5667 * Values for {@link #{{ attribute.name | screaming_snake_case }}}.
@@ -62,11 +73,16 @@ public final class {{ my_class_name }} {
6273 {% - else -%}
6374 /** Values for {@link #{{ attribute.name | screaming_snake_case }}}. */
6475 {% - endif -%}
65- {% if attribute is stable or attribute is deprecated %} @Deprecated{% endif %}
76+ {% if enum_deprecated_in_favor_of_stable . value or attribute is deprecated %} @Deprecated{% endif %}
6677 public static final class {{ attribute.name | pascal_case }}IncubatingValues {
6778 {% - for member in attribute .type .members %}
68- {{ [member.brief or (member.id ~ '.')] | comment(indent=4) }}
69- public static final {{ attribute.type | instantiated_type | map_text("java_enum_type") }} {{ member.id | screaming_snake_case }} = {{ member.value | print_member_value }};
79+ {% if member is experimental or enum_deprecated_in_favor_of_stable .value %} {{ [member.brief or (member.id ~ '.')] | comment(indent=4) }}
80+ {% if member is deprecated %} @Deprecated{% endif %} public static final {{ attribute.type | instantiated_type | map_text("java_enum_type") }} {{ member.id | screaming_snake_case }} = {{ member.value | print_member_value }};
81+ {% elif member is stable %}
82+ {% - set stable_class_link = "io.opentelemetry.semconv." ~ stable_class_name ~ "." ~ (attribute .name | pascal_case ) ~ "Values#" ~ (member .id | screaming_snake_case ) -%}
83+ {{ [member.brief or (member.id ~ '.'), "@deprecated deprecated in favor of stable {@link " ~ stable_class_link ~ "} value."] | comment(indent=4) }}
84+ @Deprecated public static final {{ attribute.type | instantiated_type | map_text("java_enum_type") }} {{ member.id | screaming_snake_case }} = {{ member.value | print_member_value }};
85+ {% - endif -%}
7086 {% - endfor %}
7187 private {{ attribute.name | pascal_case }}IncubatingValues() {}
7288 }
0 commit comments