11{% - macro to_java_key_type (attribute ) -%}
2- {% - if attribute .type is template_type -%}
3- {{ attribute.type | instantiated_type | map_text("java_template_key_type") }}
4- {% - else -%}
5- {{ attribute.type | instantiated_type | map_text("java_key_type") }}
6- {% - endif %}
2+ {% - if attribute .type is template_type -%}
3+ {{ attribute.type | instantiated_type | map_text("java_template_key_type") }}
4+ {% - else -%}
5+ {{ attribute.type | instantiated_type | map_text("java_key_type") }}
6+ {% - endif %}
77{% - endmacro %}
8+
89{% - macro to_java_key_factory (attribute ) -%}
9- {% - if attribute .type is template_type -%}
10- {{ attribute.type | instantiated_type | map_text("java_template_key_factory") }}
11- {% - else -%}
12- {{ attribute.type | instantiated_type | map_text("java_key_factory") }}
13- {% - endif %}
10+ {% - if attribute .type is template_type -%}
11+ {{ attribute.type | instantiated_type | map_text("java_template_key_factory") }}
12+ {% - else -%}
13+ {{ attribute.type | instantiated_type | map_text("java_key_factory") }}
14+ {% - endif %}
1415{% - endmacro %}
16+
1517{% - set my_class_name = ctx .root_namespace | pascal_case ~ "IncubatingAttributes" -%}
1618{% - set stable_class_name = ctx .root_namespace | pascal_case ~ "Attributes" -%}
19+
1720/*
1821 * Copyright The OpenTelemetry Authors
1922 * SPDX-License-Identifier: Apache-2.0
@@ -36,57 +39,70 @@ import java.util.List;
3639// DO NOT EDIT, this is an Auto-generated file from buildscripts/templates/registry/incubating_java/IncubatingSemanticAttributes.java.j2
3740@SuppressWarnings("unused")
3841public final class {{ my_class_name }} {
39- {% for attribute in ctx .attributes | rejectattr ("name" , "in" , ctx .excluded_attributes ) | rejectattr ("type" , "eq" , "any" ) %}{% if attribute is experimental %}
40- {% - if attribute is deprecated %}{% - set deprecated_javadoc = "@deprecated " ~ attribute .deprecated .note -%}
41- {% - else -%}{% - set deprecated_javadoc = "" -%}
42- {% - endif -%}
43- {{ [attribute.brief, concat_if("\n\nNotes:\n\n", attribute.note), deprecated_javadoc] | comment(indent=4) }}
44- {% if attribute is deprecated %} @Deprecated{% endif %} public static final {{ to_java_key_type(attribute) | trim }} {{ attribute.name | screaming_snake_case }} = {{ to_java_key_factory(attribute) | trim }}("{{ attribute.name }}");
42+
43+ {% - for attribute in ctx .attributes | rejectattr ("name" , "in" , ctx .excluded_attributes ) | rejectattr ("type" , "eq" , "any" ) -%}
44+ {% - if attribute is experimental -%}
45+ {% - if attribute is deprecated -%}
46+ {% - set deprecated_javadoc = "@deprecated " ~ attribute .deprecated .note -%}
47+ {% - else -%}
48+ {% - set deprecated_javadoc = "" -%}
49+ {% - endif -%}
50+ {{ [attribute.brief, concat_if("\n\nNotes:\n\n", attribute.note), deprecated_javadoc] | comment }}
51+ {% - if attribute is deprecated -%}
52+ @Deprecated
53+ {% endif %}
54+ public static final {{ to_java_key_type(attribute) | trim }} {{ attribute.name | screaming_snake_case }} = {{ to_java_key_factory(attribute) | trim }}("{{ attribute.name }}");
4555 {% elif attribute is stable %}
46- {% - set stable_class_link = "io.opentelemetry.semconv." ~ stable_class_name ~ "#" ~ (attribute .name | screaming_snake_case ) -%}
47- {{ [attribute.brief, concat_if("\n\nNotes:\n\n", attribute.note), "@deprecated deprecated in favor of stable {@link " ~ stable_class_link ~ "} attribute."] | comment(indent=4) }}
48- @Deprecated public static final {{ to_java_key_type(attribute) | trim }} {{ attribute.name | screaming_snake_case }} = {{ to_java_key_factory(attribute) | trim }}("{{ attribute.name }}");
56+ {% - set stable_class_link = "io.opentelemetry.semconv." ~ stable_class_name ~ "#" ~ (attribute .name | screaming_snake_case ) -%}
57+ {{ [attribute.brief, concat_if("\n\nNotes:\n\n", attribute.note), "@deprecated deprecated in favor of stable {@link " ~ stable_class_link ~ "} attribute."] | comment }}
58+ @Deprecated public static final {{ to_java_key_type(attribute) | trim }} {{ attribute.name | screaming_snake_case }} = {{ to_java_key_factory(attribute) | trim }}("{{ attribute.name }}");
4959 {% endif %}
50- {% endfor %}
51- // Enum definitions
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 %}
60+ {% endfor %}
61+
62+ // Enum definitions
63+ {% for attribute in ctx .attributes | select ("enum" ) | rejectattr ("name" , "in" , ctx .excluded_attributes ) %}
64+ {% - set enum_deprecated_in_favor_of_stable = namespace (value =false ) -%}
65+ {% - if attribute is stable -%}
5566 {% - set enum_deprecated_in_favor_of_stable .value = true -%}
5667 {% - endif -%}
5768 {% - 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 -%}
69+ {% if member is experimental %}
70+ {% if not member is deprecated %}
71+ {% - set enum_deprecated_in_favor_of_stable .value = false -%}
72+ {% - endif -%}
73+ {% - endif -%}
6374 {% - endfor %}
6475 {% - if enum_deprecated_in_favor_of_stable .value -%}
65- {% - set stable_class_link = "io.opentelemetry.semconv." ~ stable_class_name ~ "." ~ (attribute .name | pascal_case ) ~ "Values" -%}
66- /**
67- * Values for {@link #{{ attribute.name | screaming_snake_case }}}.
68- *
69- * @deprecated deprecated in favor of stable {@link {{stable_class_link}}}.
70- */
76+ {% - set stable_class_link = "io.opentelemetry.semconv." ~ stable_class_name ~ "." ~ (attribute .name | pascal_case ) ~ "Values" -%}
77+ /**
78+ * Values for {@link #{{ attribute.name | screaming_snake_case }}}.
79+ *
80+ * @deprecated deprecated in favor of stable {@link {{stable_class_link}}}.
81+ */
7182 {% - elif attribute is deprecated -%}
72- {{ ["Values for {@link #" ~ attribute.name | screaming_snake_case ~ "}", "@deprecated " ~ attribute.deprecated.note ] | comment }}
83+ {{ ["Values for {@link #" ~ attribute.name | screaming_snake_case ~ "}", "@deprecated " ~ attribute.deprecated.note ] | comment }}
7384 {% - else -%}
74- /** Values for {@link #{{ attribute.name | screaming_snake_case }}}. */
85+ /** Values for {@link #{{ attribute.name | screaming_snake_case }}}. */
7586 {% - endif -%}
76- {% if enum_deprecated_in_favor_of_stable .value or attribute is deprecated %} @Deprecated{% endif %}
87+ {% - if enum_deprecated_in_favor_of_stable .value or attribute is deprecated -%}
88+ @Deprecated
89+ {% endif %}
7790 public static final class {{ attribute.name | pascal_case }}IncubatingValues {
7891 {% - for member in attribute .type .members %}
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 -%}
92+ {% if member is experimental or enum_deprecated_in_favor_of_stable .value %} {{ [member.brief or (member.id ~ '.')] | comment }}
93+ {% - if member is deprecated -%}
94+ @Deprecated
95+ {% - endif -%}
96+ public static final {{ attribute.type | instantiated_type | map_text("java_enum_type") }} {{ member.id | screaming_snake_case }} = {{ member.value | print_member_value }};
97+ {% elif member is stable %}
98+ {% - set stable_class_link = "io.opentelemetry.semconv." ~ stable_class_name ~ "." ~ (attribute .name | pascal_case ) ~ "Values#" ~ (member .id | screaming_snake_case ) -%}
99+ {{ [member.brief or (member.id ~ '.'), "@deprecated deprecated in favor of stable {@link " ~ stable_class_link ~ "} value."] | comment }}
100+ @Deprecated public static final {{ attribute.type | instantiated_type | map_text("java_enum_type") }} {{ member.id | screaming_snake_case }} = {{ member.value | print_member_value }};
101+ {% - endif -%}
86102 {% - endfor %}
87103 private {{ attribute.name | pascal_case }}IncubatingValues() {}
88104 }
89- {% endfor %}
105+ {% endfor %}
90106
91- private {{ my_class_name }}() {}
107+ private {{ my_class_name }}() {}
92108}
0 commit comments