Skip to content

Commit 93b93e1

Browse files
committed
update bridge to match agent
1 parent fedec51 commit 93b93e1

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

declarative-config-bridge/src/main/java/io/opentelemetry/contrib/sdk/autoconfigure/ConfigPropertiesTranslator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ String translateProperty(String property) {
3030
return property;
3131
}
3232

33+
@SuppressWarnings("unchecked")
3334
@Nullable
34-
public Object get(String propertyName) {
35-
return fixedValues.get(propertyName);
35+
public <T> T get(String propertyName) {
36+
return (T) fixedValues.get(propertyName);
3637
}
3738
}

declarative-config-bridge/src/main/java/io/opentelemetry/contrib/sdk/autoconfigure/DeclarativeConfigPropertiesBridge.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,11 @@ public Duration getDuration(String propertyName) {
126126
return Duration.ofMillis(millis);
127127
}
128128

129-
@SuppressWarnings("unchecked")
130129
@Override
131130
public List<String> getList(String propertyName) {
132-
Object value = translator.get(propertyName);
131+
List<String> value = translator.get(propertyName);
133132
if (value != null) {
134-
return (List<String>) value;
133+
return value;
135134
}
136135
List<String> propertyValue =
137136
getPropertyValue(
@@ -140,12 +139,11 @@ public List<String> getList(String propertyName) {
140139
return propertyValue == null ? Collections.emptyList() : propertyValue;
141140
}
142141

143-
@SuppressWarnings("unchecked")
144142
@Override
145143
public Map<String, String> getMap(String propertyName) {
146-
Object fixed = translator.get(propertyName);
144+
Map<String, String> fixed = translator.get(propertyName);
147145
if (fixed != null) {
148-
return (Map<String, String>) fixed;
146+
return fixed;
149147
}
150148
DeclarativeConfigProperties propertyValue =
151149
getPropertyValue(propertyName, DeclarativeConfigProperties::getStructured);

0 commit comments

Comments
 (0)