Class ClassFunctionalTools
java.lang.Object
org.machanism.machai.gw.maven.tools.ClassFunctionalTools
- All Implemented Interfaces:
org.machanism.machai.ai.tools.FunctionTools
public class ClassFunctionalTools
extends Object
implements org.machanism.machai.ai.tools.FunctionTools
Provides function-tool integrations for discovering Java classes and reading
reflective metadata from the classpath of one or more Maven projects.
Instances maintain a cache of ClassInfoHolder objects keyed by Maven
project base directory, allowing tool invocations to resolve classes relative
to the current working project.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty instance.ClassFunctionalTools(org.apache.maven.project.MavenProject project) Creates a new instance backed by the supplied Maven project's classpath. -
Method Summary
Modifier and TypeMethodDescriptionFinds fully qualified class names whose simple names match the supplied regular expression.getClassInfo(String className, File projectDir) Returns reflective information for the specified class.voidscanProjectClasses(org.apache.maven.project.MavenProject project) Registers a project by scanning and caching class metadata for its base directory.
-
Constructor Details
-
ClassFunctionalTools
public ClassFunctionalTools(org.apache.maven.project.MavenProject project) Creates a new instance backed by the supplied Maven project's classpath.- Parameters:
project- the Maven project used to resolve classpath and output directories
-
ClassFunctionalTools
public ClassFunctionalTools()Creates an empty instance. Projects must be registered later throughscanProjectClasses(MavenProject)before tool invocations can resolve class information.
-
-
Method Details
-
scanProjectClasses
public void scanProjectClasses(org.apache.maven.project.MavenProject project) Registers a project by scanning and caching class metadata for its base directory.- Parameters:
project- the Maven project to register
-
findClass
Finds fully qualified class names whose simple names match the supplied regular expression. -
getClassInfo
Returns reflective information for the specified class.The generated output may include modifiers, superclass, interfaces, non-private fields, constructors, non-private methods, annotations, class path, and dependency artifact coordinates.
- Parameters:
params- tool invocation arguments; the first argument is expected to be aHashMapcontaining aclassNameproperty and the second aFilerepresenting the current working directory- Returns:
- a HashMap describing the requested class or containing an
errorproperty when the class or project context cannot be resolved
-