Class JavaMethodToolParameter

java.lang.Object
uno.anahata.asi.agi.tool.spi.AbstractToolParameter<JavaMethodTool>
uno.anahata.asi.agi.tool.spi.java.JavaMethodToolParameter

public class JavaMethodToolParameter extends AbstractToolParameter<JavaMethodTool>
A subclass of AbstractToolParameter that holds Java-specific reflection information, namely the full generic Type of the parameter.
Author:
anahata-gemini-pro-2.5
  • Field Details

    • javaType

      private transient Type javaType
      The full Java reflection Type, preserving generics.
    • index

      private final int index
      The index of this parameter in the method's parameter list.
  • Constructor Details

    • JavaMethodToolParameter

      private JavaMethodToolParameter(@NonNull @NonNull JavaMethodTool tool, @NonNull @NonNull String name, @NonNull @NonNull String description, @NonNull @NonNull String jsonSchema, boolean required, String rendererId, @NonNull @NonNull Type javaType, int index)
      Private constructor for initializing a JavaMethodToolParameter.
      Parameters:
      tool - The parent JavaMethodTool.
      name - The parameter name.
      description - A descriptive label/instruction for the parameter.
      jsonSchema - The raw OpenAPI 3 JSON schema.
      required - Whether this parameter is mandatory.
      rendererId - An optional custom renderer ID.
      javaType - The native Java reflection type.
      index - The parameter position.
  • Method Details

    • getJavaType

      public Type getJavaType()
      Returns the full Java reflection Type, restoring it lazily if necessary.
      Returns:
      The parameter's Java type.
    • of

      public static JavaMethodToolParameter of(JavaMethodTool tool, Parameter p, int index) throws Exception
      The definitive factory method for creating a JavaMethodToolParameter from a reflection Parameter. This method encapsulates all the logic for parsing annotations and generating the schema.
      Parameters:
      tool - The parent JavaMethodTool.
      p - The reflection Parameter to parse.
      index - The index of the parameter.
      Returns:
      A new, fully configured JavaMethodToolParameter.
      Throws:
      Exception - if schema generation fails.