diff --git a/buildscripts/templates/registry/incubating_java/IncubatingSemanticAttributes.java.j2 b/buildscripts/templates/registry/incubating_java/IncubatingSemanticAttributes.java.j2 index 22668d24..e963cce5 100644 --- a/buildscripts/templates/registry/incubating_java/IncubatingSemanticAttributes.java.j2 +++ b/buildscripts/templates/registry/incubating_java/IncubatingSemanticAttributes.java.j2 @@ -1,19 +1,22 @@ {%- macro to_java_key_type(attribute) -%} - {%- if attribute.type is template_type -%} - {{ attribute.type | instantiated_type | map_text("java_template_key_type") }} - {%- else -%} - {{ attribute.type | instantiated_type | map_text("java_key_type") }} - {%- endif %} + {%- if attribute.type is template_type -%} + {{ attribute.type | instantiated_type | map_text("java_template_key_type") }} + {%- else -%} + {{ attribute.type | instantiated_type | map_text("java_key_type") }} + {%- endif %} {%- endmacro %} + {%- macro to_java_key_factory(attribute) -%} - {%- if attribute.type is template_type -%} - {{ attribute.type | instantiated_type | map_text("java_template_key_factory") }} - {%- else -%} - {{ attribute.type | instantiated_type | map_text("java_key_factory") }} - {%- endif %} + {%- if attribute.type is template_type -%} + {{ attribute.type | instantiated_type | map_text("java_template_key_factory") }} + {%- else -%} + {{ attribute.type | instantiated_type | map_text("java_key_factory") }} + {%- endif %} {%- endmacro %} + {%- set my_class_name = ctx.root_namespace | pascal_case ~ "IncubatingAttributes" -%} {%- set stable_class_name = ctx.root_namespace | pascal_case ~ "Attributes" -%} + /* * Copyright The OpenTelemetry Authors * SPDX-License-Identifier: Apache-2.0 @@ -36,57 +39,70 @@ import java.util.List; // DO NOT EDIT, this is an Auto-generated file from buildscripts/templates/registry/incubating_java/IncubatingSemanticAttributes.java.j2 @SuppressWarnings("unused") public final class {{ my_class_name }} { - {% for attribute in ctx.attributes | rejectattr("name", "in", ctx.excluded_attributes) | rejectattr("type", "eq", "any") %}{% if attribute is experimental %} - {%- if attribute is deprecated %}{%- set deprecated_javadoc = "@deprecated " ~ attribute.deprecated.note -%} - {%- else -%}{%- set deprecated_javadoc = "" -%} - {%- endif -%} - {{ [attribute.brief, concat_if("\n\nNotes:\n\n", attribute.note), deprecated_javadoc] | comment(indent=4) }} - {% 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 }}"); + + {%- for attribute in ctx.attributes | rejectattr("name", "in", ctx.excluded_attributes) | rejectattr("type", "eq", "any") -%} + {%- if attribute is experimental -%} + {%- if attribute is deprecated -%} + {%- set deprecated_javadoc = "@deprecated " ~ attribute.deprecated.note -%} + {%- else -%} + {%- set deprecated_javadoc = "" -%} + {%- endif -%} + {{ [attribute.brief, concat_if("\n\nNotes:\n\n", attribute.note), deprecated_javadoc] | comment }} + {%- 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 }}"); {% elif attribute is stable %} - {%- set stable_class_link = "io.opentelemetry.semconv." ~ stable_class_name ~ "#" ~ (attribute.name | screaming_snake_case) -%} - {{ [attribute.brief, concat_if("\n\nNotes:\n\n", attribute.note), "@deprecated deprecated in favor of stable {@link " ~ stable_class_link ~ "} attribute."] | comment(indent=4) }} - @Deprecated public static final {{ to_java_key_type(attribute) | trim }} {{ attribute.name | screaming_snake_case }} = {{ to_java_key_factory(attribute) | trim }}("{{ attribute.name }}"); + {%- set stable_class_link = "io.opentelemetry.semconv." ~ stable_class_name ~ "#" ~ (attribute.name | screaming_snake_case) -%} + {{ [attribute.brief, concat_if("\n\nNotes:\n\n", attribute.note), "@deprecated deprecated in favor of stable {@link " ~ stable_class_link ~ "} attribute."] | comment }} + @Deprecated public static final {{ to_java_key_type(attribute) | trim }} {{ attribute.name | screaming_snake_case }} = {{ to_java_key_factory(attribute) | trim }}("{{ attribute.name }}"); {% endif %} - {% endfor %} - // Enum definitions - {% for attribute in ctx.attributes | select("enum") | rejectattr("name", "in", ctx.excluded_attributes) %} - {% set enum_deprecated_in_favor_of_stable = namespace(value=false) %} - {% if attribute is stable %} + {% endfor %} + + // Enum definitions + {% for attribute in ctx.attributes | select("enum") | rejectattr("name", "in", ctx.excluded_attributes) %} + {%- set enum_deprecated_in_favor_of_stable = namespace(value=false) -%} + {%- if attribute is stable -%} {%- set enum_deprecated_in_favor_of_stable.value = true -%} {%- endif -%} {%- for member in attribute.type.members %} - {% if member is experimental %} - {% if not member is deprecated %} - {%- set enum_deprecated_in_favor_of_stable.value = false -%} - {%- endif -%} - {%- endif -%} + {% if member is experimental %} + {% if not member is deprecated %} + {%- set enum_deprecated_in_favor_of_stable.value = false -%} + {%- endif -%} + {%- endif -%} {%- endfor %} {%- if enum_deprecated_in_favor_of_stable.value -%} - {%- set stable_class_link = "io.opentelemetry.semconv." ~ stable_class_name ~ "." ~ (attribute.name | pascal_case) ~ "Values" -%} - /** - * Values for {@link #{{ attribute.name | screaming_snake_case }}}. - * - * @deprecated deprecated in favor of stable {@link {{stable_class_link}}}. - */ + {%- set stable_class_link = "io.opentelemetry.semconv." ~ stable_class_name ~ "." ~ (attribute.name | pascal_case) ~ "Values" -%} + /** + * Values for {@link #{{ attribute.name | screaming_snake_case }}}. + * + * @deprecated deprecated in favor of stable {@link {{stable_class_link}}}. + */ {%- elif attribute is deprecated -%} - {{ ["Values for {@link #" ~ attribute.name | screaming_snake_case ~ "}", "@deprecated " ~ attribute.deprecated.note ] | comment }} + {{ ["Values for {@link #" ~ attribute.name | screaming_snake_case ~ "}", "@deprecated " ~ attribute.deprecated.note ] | comment }} {%- else -%} - /** Values for {@link #{{ attribute.name | screaming_snake_case }}}. */ + /** Values for {@link #{{ attribute.name | screaming_snake_case }}}. */ {%- endif -%} - {% if enum_deprecated_in_favor_of_stable.value or attribute is deprecated %}@Deprecated{% endif %} + {%- if enum_deprecated_in_favor_of_stable.value or attribute is deprecated -%} + @Deprecated + {% endif %} public static final class {{ attribute.name | pascal_case }}IncubatingValues { {%- for member in attribute.type.members %} - {% if member is experimental or enum_deprecated_in_favor_of_stable.value %}{{ [member.brief or (member.id ~ '.')] | comment(indent=4) }} - {% 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 }}; - {% elif member is stable %} - {%- set stable_class_link = "io.opentelemetry.semconv." ~ stable_class_name ~ "." ~ (attribute.name | pascal_case) ~ "Values#" ~ (member.id | screaming_snake_case) -%} - {{ [member.brief or (member.id ~ '.'), "@deprecated deprecated in favor of stable {@link " ~ stable_class_link ~ "} value."] | comment(indent=4) }} - @Deprecated public static final {{ attribute.type | instantiated_type | map_text("java_enum_type") }} {{ member.id | screaming_snake_case }} = {{ member.value | print_member_value }}; - {%- endif -%} + {% if member is experimental or enum_deprecated_in_favor_of_stable.value %}{{ [member.brief or (member.id ~ '.')] | comment }} + {%- 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 }}; + {% elif member is stable %} + {%- set stable_class_link = "io.opentelemetry.semconv." ~ stable_class_name ~ "." ~ (attribute.name | pascal_case) ~ "Values#" ~ (member.id | screaming_snake_case) -%} + {{ [member.brief or (member.id ~ '.'), "@deprecated deprecated in favor of stable {@link " ~ stable_class_link ~ "} value."] | comment }} + @Deprecated public static final {{ attribute.type | instantiated_type | map_text("java_enum_type") }} {{ member.id | screaming_snake_case }} = {{ member.value | print_member_value }}; + {%- endif -%} {%- endfor %} private {{ attribute.name | pascal_case }}IncubatingValues() {} } - {% endfor %} + {% endfor %} - private {{ my_class_name }}() {} + private {{ my_class_name }}() {} } diff --git a/buildscripts/templates/registry/java/SemanticAttributes.java.j2 b/buildscripts/templates/registry/java/SemanticAttributes.java.j2 index e37c3919..20a2cfc8 100644 --- a/buildscripts/templates/registry/java/SemanticAttributes.java.j2 +++ b/buildscripts/templates/registry/java/SemanticAttributes.java.j2 @@ -1,17 +1,19 @@ {%- macro to_java_key_type(attribute) -%} - {%- if attribute.type is template_type -%} - {{ attribute.type | instantiated_type | map_text("java_template_key_type") }} - {%- else -%} - {{ attribute.type | instantiated_type | map_text("java_key_type") }} - {%- endif %} + {%- if attribute.type is template_type -%} + {{ attribute.type | instantiated_type | map_text("java_template_key_type") }} + {%- else -%} + {{ attribute.type | instantiated_type | map_text("java_key_type") }} + {%- endif %} {%- endmacro %} + {%- macro to_java_key_factory(attribute) -%} - {%- if attribute.type is template_type -%} - {{ attribute.type | instantiated_type | map_text("java_template_key_factory") }} - {%- else -%} - {{ attribute.type | instantiated_type | map_text("java_key_factory") }} - {%- endif %} + {%- if attribute.type is template_type -%} + {{ attribute.type | instantiated_type | map_text("java_template_key_factory") }} + {%- else -%} + {{ attribute.type | instantiated_type | map_text("java_key_factory") }} + {%- endif %} {%- endmacro %} + {%- set my_class_name = ctx.root_namespace | pascal_case ~ "Attributes" -%} /* @@ -36,24 +38,31 @@ import java.util.List; // DO NOT EDIT, this is an Auto-generated file from buildscripts/templates/registry/java/SemanticAttributes.java.j2 @SuppressWarnings("unused") public final class {{ my_class_name }} { - {% for attribute in ctx.attributes | rejectattr("name", "in", ctx.excluded_attributes) %}{% if attribute is stable %} - {%- if attribute is deprecated %} - {%- set deprecated_javadoc = "@deprecated " ~ attribute.deprecated.note -%} + {%- for attribute in ctx.attributes | rejectattr("name", "in", ctx.excluded_attributes) -%} + {%- if attribute is stable -%} + {%- if attribute is deprecated -%} + {%- set deprecated_javadoc = "@deprecated " ~ attribute.deprecated.note -%} + {%- endif -%} + {{ [attribute.brief, concat_if("\n\nNotes:\n\n", attribute.note), deprecated_javadoc] | comment }} + {%- 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 }}"); {%- endif -%} - {{ [attribute.brief, concat_if("\n\nNotes:\n\n", attribute.note), deprecated_javadoc] | comment(indent=4) }} - {% 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 }}"); - {% endif %}{% endfor %} - {% for attribute in ctx.attributes %}{% if attribute is enum and attribute is stable %} - // Enum definition - /** Values for {@link #{{ attribute.name | screaming_snake_case }}}. */ - public static final class {{ attribute.name | pascal_case }}Values { - {%- for member in attribute.type.members %} - {{ [member.brief or (member.id ~ '.')] | comment(indent=4) }} - public static final {{ attribute.type | instantiated_type | map_text("java_enum_type") }} {{ member.id | screaming_snake_case }} = {{ member.value | print_member_value }}; - {%- endfor %} - private {{ attribute.name | pascal_case }}Values() {} - } - {% endif %}{% endfor %} - - private {{ my_class_name }}() {} + {%- endfor %} + + {%- for attribute in ctx.attributes -%} + {%- if attribute is enum and attribute is stable %} + // Enum definition + /** Values for {@link #{{ attribute.name | screaming_snake_case }}}. */ + public static final class {{ attribute.name | pascal_case }}Values { + {%- for member in attribute.type.members %} + {{ [member.brief or (member.id ~ '.')] | comment }} + public static final {{ attribute.type | instantiated_type | map_text("java_enum_type") }} {{ member.id | screaming_snake_case }} = {{ member.value | print_member_value }}; + {%- endfor %} + private {{ attribute.name | pascal_case }}Values() {} + } + {%- endif -%} + {%- endfor %} + + private {{ my_class_name }}() {} }