
io.opentelemetry.javaagent.tooling.field.FieldAccessorInterfaces Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of opentelemetry-javaagent-tooling Show documentation
Show all versions of opentelemetry-javaagent-tooling Show documentation
Instrumentation of Java libraries using OpenTelemetry.
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.tooling.field;
import static io.opentelemetry.javaagent.tooling.field.GeneratedVirtualFieldNames.getFieldAccessorInterfaceName;
import java.util.Collection;
import java.util.Map;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.DynamicType;
final class FieldAccessorInterfaces {
// field-accessor-interface-name -> fields-accessor-interface-dynamic-type
private final Map> fieldAccessorInterfaces;
FieldAccessorInterfaces(Map> fieldAccessorInterfaces) {
this.fieldAccessorInterfaces = fieldAccessorInterfaces;
}
TypeDescription find(String typeName, String fieldTypeName) {
String accessorInterfaceName = getFieldAccessorInterfaceName(typeName, fieldTypeName);
DynamicType.Unloaded> type = fieldAccessorInterfaces.get(accessorInterfaceName);
if (type == null) {
throw new IllegalStateException(
"Couldn't find field accessor interface named " + accessorInterfaceName);
}
return type.getTypeDescription();
}
Collection> getAllInterfaces() {
return fieldAccessorInterfaces.values();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy