File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
javaagent-bootstrap/src/main/java/io/opentelemetry/javaagent/bootstrap Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 55
66package io .opentelemetry .javaagent .bootstrap ;
77
8+ /**
9+ * Interface added to indy proxies to allow unwrapping the proxy object
10+ */
811public interface IndyProxy {
912
13+ /**
14+ * Unwraps the proxy delegate instance
15+ *
16+ * @return wrapped object instance
17+ */
1018 // Method name does not fit common naming practices on purpose
1119 // Also, when modifying this make sure to also update string references.
1220 @ SuppressWarnings ("all" )
Original file line number Diff line number Diff line change @@ -9,6 +9,16 @@ public class IndyProxyHelper {
99
1010 private IndyProxyHelper () {}
1111
12+ /**
13+ * Unwraps and casts an indy proxy, or just casts if it's not an indy proxy.
14+ *
15+ * @param <T> type of object to return
16+ * @param o object to unwrap
17+ * @param type expected object type
18+ * @return unwrapped proxy instance or the original object (if not a proxy) cast to the expected type
19+ * @throws IllegalArgumentException if the provided object the proxied object can't be cast to the expected type
20+ *
21+ */
1222 public static <T > T unwrapIfNeeded (Object o , Class <T > type ) {
1323 if (type .isAssignableFrom (o .getClass ())) {
1424 return type .cast (o );
You can’t perform that action at this time.
0 commit comments