Class ToolIntrospector
ToolSpecification instances without requiring @Tool annotations.-
Method Summary
Modifier and TypeMethodDescriptionstatic List<ToolMethod> introspect(Object... toolObjects) Discovers all eligible public methods on the given objects and createsToolMethodentries for each.static Class<?> resolveTargetClass(Object obj) Resolves the actual bean class behind a CDI/EJB proxy.
-
Method Details
-
introspect
Discovers all eligible public methods on the given objects and createsToolMethodentries for each.If the object is a Jakarta EJB proxy (CDI/Weld-injected
@Stateless,@Stateful, or@Singletonbean), the methods are read from the actual bean class (the proxy's superclass) while the proxy instance is kept as the invocation target. This ensures method calls still go through the container pipeline (transactions, security, interceptors). -
resolveTargetClass
Resolves the actual bean class behind a CDI/EJB proxy.CDI containers (Weld, OpenWebBeans, etc.) create proxy subclasses when injecting EJB beans. The proxy class itself has no business methods declared — they live on the superclass (the real bean class). This method detects whether the object is such a proxy by checking if the superclass carries a Jakarta EJB annotation (
@Stateless,@Stateful, or@Singleton). If so, the superclass is returned for method discovery; otherwise the object's own class is returned.- Parameters:
obj- the tool object (possibly a proxy)- Returns:
- the class to use for method discovery
-