|
| 1 | +/* |
| 2 | + * Copyright The OpenTelemetry Authors |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + */ |
| 5 | + |
1 | 6 | package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_55.incubator.config; |
2 | 7 |
|
3 | 8 | import application.io.opentelemetry.api.incubator.config.DeclarativeConfigProperties; |
| 9 | +import application.io.opentelemetry.common.ComponentLoader; |
| 10 | +import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.v1_55.common.ApplicationComponentLoader155; |
| 11 | +import java.util.List; |
| 12 | +import java.util.Set; |
| 13 | +import java.util.stream.Collectors; |
| 14 | +import javax.annotation.Nullable; |
| 15 | + |
| 16 | +public class ApplicationDeclarativeConfigProperties155Incubator |
| 17 | + implements DeclarativeConfigProperties { |
| 18 | + private final io.opentelemetry.api.incubator.config.DeclarativeConfigProperties |
| 19 | + instrumentationConfig; |
| 20 | + |
| 21 | + public ApplicationDeclarativeConfigProperties155Incubator( |
| 22 | + io.opentelemetry.api.incubator.config.DeclarativeConfigProperties instrumentationConfig) { |
| 23 | + this.instrumentationConfig = instrumentationConfig; |
| 24 | + } |
| 25 | + |
| 26 | + @Nullable |
| 27 | + @Override |
| 28 | + public String getString(String name) { |
| 29 | + return instrumentationConfig.getString(name); |
| 30 | + } |
| 31 | + |
| 32 | + @Override |
| 33 | + public String getString(String name, String defaultValue) { |
| 34 | + return instrumentationConfig.getString(name, defaultValue); |
| 35 | + } |
| 36 | + |
| 37 | + @Nullable |
| 38 | + @Override |
| 39 | + public Boolean getBoolean(String name) { |
| 40 | + return instrumentationConfig.getBoolean(name); |
| 41 | + } |
| 42 | + |
| 43 | + @Override |
| 44 | + public boolean getBoolean(String name, boolean defaultValue) { |
| 45 | + return instrumentationConfig.getBoolean(name, defaultValue); |
| 46 | + } |
| 47 | + |
| 48 | + @Nullable |
| 49 | + @Override |
| 50 | + public Integer getInt(String name) { |
| 51 | + return instrumentationConfig.getInt(name); |
| 52 | + } |
| 53 | + |
| 54 | + @Override |
| 55 | + public int getInt(String name, int defaultValue) { |
| 56 | + return instrumentationConfig.getInt(name, defaultValue); |
| 57 | + } |
| 58 | + |
| 59 | + @Nullable |
| 60 | + @Override |
| 61 | + public Long getLong(String name) { |
| 62 | + return instrumentationConfig.getLong(name); |
| 63 | + } |
| 64 | + |
| 65 | + @Override |
| 66 | + public long getLong(String name, long defaultValue) { |
| 67 | + return instrumentationConfig.getLong(name, defaultValue); |
| 68 | + } |
| 69 | + |
| 70 | + @Nullable |
| 71 | + @Override |
| 72 | + public Double getDouble(String name) { |
| 73 | + return instrumentationConfig.getDouble(name); |
| 74 | + } |
| 75 | + |
| 76 | + @Override |
| 77 | + public double getDouble(String name, double defaultValue) { |
| 78 | + return instrumentationConfig.getDouble(name, defaultValue); |
| 79 | + } |
| 80 | + |
| 81 | + @Nullable |
| 82 | + @Override |
| 83 | + public <T> List<T> getScalarList(String name, Class<T> scalarType) { |
| 84 | + return instrumentationConfig.getScalarList(name, scalarType); |
| 85 | + } |
| 86 | + |
| 87 | + @Override |
| 88 | + public <T> List<T> getScalarList(String name, Class<T> scalarType, List<T> defaultValue) { |
| 89 | + return instrumentationConfig.getScalarList(name, scalarType, defaultValue); |
| 90 | + } |
| 91 | + |
| 92 | + @Nullable |
| 93 | + @Override |
| 94 | + public DeclarativeConfigProperties getStructured(String name) { |
| 95 | + return new ApplicationDeclarativeConfigProperties155Incubator( |
| 96 | + instrumentationConfig.getStructured(name)); |
| 97 | + } |
| 98 | + |
| 99 | + @Nullable |
| 100 | + @Override |
| 101 | + public List<DeclarativeConfigProperties> getStructuredList(String name) { |
| 102 | + List<io.opentelemetry.api.incubator.config.DeclarativeConfigProperties> structuredList = |
| 103 | + instrumentationConfig.getStructuredList(name); |
| 104 | + if (structuredList == null) { |
| 105 | + return null; |
| 106 | + } |
| 107 | + |
| 108 | + return structuredList.stream() |
| 109 | + .map(e -> new ApplicationDeclarativeConfigProperties155Incubator(e)) |
| 110 | + .collect(Collectors.toList()); |
| 111 | + } |
| 112 | + |
| 113 | + @Override |
| 114 | + public Set<String> getPropertyKeys() { |
| 115 | + return instrumentationConfig.getPropertyKeys(); |
| 116 | + } |
4 | 117 |
|
5 | | -public class ApplicationDeclarativeConfigProperties155Incubator implements |
6 | | - DeclarativeConfigProperties {} |
| 118 | + @Override |
| 119 | + public ComponentLoader getComponentLoader() { |
| 120 | + return new ApplicationComponentLoader155(instrumentationConfig.getComponentLoader()); |
| 121 | + } |
| 122 | +} |
0 commit comments