Class AgentStaticLoader

java.lang.Object
com.google.adk.web.AgentStaticLoader
All Implemented Interfaces:
AgentLoader

public class AgentStaticLoader extends Object implements AgentLoader
用于程序化加载代理程序的静态代理加载器(Static Agent Loader)。

这个加载器会使用一个预先创建的代理实例列表,并通过 `AgentLoader` 接口将这些代理实例提供给应用程序使用。非常适合那些已经拥有代理实例、但只需要一种方便的方式来将这些代理实例封装到 `AgentLoader` 中的情况。

这个类本身并不是 Spring 组件;它的实例是通过编程方式创建的,然后通过工厂方法(factory methods)被注册为 Spring 的 Bean 对象。

  • 构造函数详细信息

    • AgentStaticLoader

      public AgentStaticLoader(BaseAgent... agents)
  • 方法详细信息(Method Details)

    • listAgents

      @Nonnull public com.google.common.collect.ImmutableList<String> listAgents()
      描述内容复制自接口文档: AgentLoader
      返回一个包含所有可用代理名称的列表。
      Specified by:
      listAgents in interface AgentLoader
      Returns:
      ImmutableList of agent names. Must not return null - return an empty list if no agents are available.
    • loadAgent

      public BaseAgent loadAgent(String name)
      描述内容复制自接口文档: AgentLoader
      加载指定代理名称对应的 BaseAgent 实例。
      Specified by:
      loadAgent in interface AgentLoader
      Parameters:
      name - the name of the agent to load
      Returns:
      BaseAgent instance for the given name