Skip to content

Commit c13b72e

Browse files
committed
add a bit of javadoc
1 parent 56f1aa9 commit c13b72e

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

javaagent-bootstrap/src/main/java/io/opentelemetry/javaagent/bootstrap/IndyProxy.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,16 @@
55

66
package io.opentelemetry.javaagent.bootstrap;
77

8+
/**
9+
* Interface added to indy proxies to allow unwrapping the proxy object
10+
*/
811
public 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")

javaagent-bootstrap/src/main/java/io/opentelemetry/javaagent/bootstrap/IndyProxyHelper.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)