# Class CustomDemoRegistry

java.lang.Object
com.google.adk.utils.ComponentRegistry
com.example.CustomDemoRegistry

public class CustomDemoRegistry extends ComponentRegistry
Custom ComponentRegistry for the user-defined config agent demo.

This registry is used to add custom tools and agents to the ADK Web Server.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final CustomDemoRegistry`
  `INSTANCE`
  Singleton instance for easy access

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CustomDemoRegistry()`
  Private constructor to initialize custom components

- ## Method Summary

  ### Methods inherited from class ComponentRegistry

  `get, get, getInstance, getToolNamesWithPrefix, register, resolveAfterAgentCallback, resolveAfterModelCallback, resolveAfterToolCallback, resolveAgentClass, resolveAgentInstance, resolveBeforeAgentCallback, resolveBeforeModelCallback, resolveBeforeToolCallback, resolveToolClass, resolveToolInstance, resolveToolsetClass, resolveToolsetInstance, setInstance`
  Modifier and Type
  Method
  Description
  `Optional<Object>`
  `get(String name)`
  Retrieves an object by name without type checking.
  `<T> Optional<T>`
  `get(String name, Class<T> type)`
  Retrieves an object by name and attempts to cast it to the specified type.
  `static ComponentRegistry`
  `getInstance()`
  Returns the global singleton instance of ComponentRegistry.
  `Set<String>`
  `getToolNamesWithPrefix(String prefix)`
  `void`
  `register(String name, Object value)`
  Registers an object with the given name.
  `static Optional<Callbacks.AfterAgentCallback>`
  `resolveAfterAgentCallback(String name)`
  `static Optional<Callbacks.AfterModelCallback>`
  `resolveAfterModelCallback(String name)`
  `static Optional<Callbacks.AfterToolCallback>`
  `resolveAfterToolCallback(String name)`
  `static Class<? extends BaseAgent>`
  `resolveAgentClass(String agentClassName)`
  Resolves the agent class based on the agent class name from the configuration.
  `static Optional<BaseAgent>`
  `resolveAgentInstance(String name)`
  Resolves an agent instance from the registry.
  `static Optional<Callbacks.BeforeAgentCallback>`
  `resolveBeforeAgentCallback(String name)`
  `static Optional<Callbacks.BeforeModelCallback>`
  `resolveBeforeModelCallback(String name)`
  `static Optional<Callbacks.BeforeToolCallback>`
  `resolveBeforeToolCallback(String name)`
  `static Optional<Class<? extends BaseTool>>`
  `resolveToolClass(String toolClassName)`
  Resolves the tool class based on the tool class name from the configuration.
  `static Optional<BaseTool>`
  `resolveToolInstance(String name)`
  `static Optional<Class<? extends BaseToolset>>`
  `resolveToolsetClass(String toolsetClassName)`
  Resolves a toolset class by name from the registry or by attempting to load it.
  `static Optional<BaseToolset>`
  `resolveToolsetInstance(String name)`
  Resolves a toolset instance by name from the registry.
  `static void`
  `setInstance(ComponentRegistry newInstance)`
  Updates the global singleton instance with a new ComponentRegistry.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### INSTANCE

    public static final CustomDemoRegistry INSTANCE
    Singleton instance for easy access

- ## Constructor Details

  - ### CustomDemoRegistry

    public CustomDemoRegistry()
    Private constructor to initialize custom components