Class AbstractMcpResourceMethodCallback.AbstractBuilder<T extends AbstractMcpResourceMethodCallback.AbstractBuilder<T,R>,R>

java.lang.Object
org.springaicommunity.mcp.method.resource.AbstractMcpResourceMethodCallback.AbstractBuilder<T,R>
Type Parameters:
T - The type of the builder
R - The type of the callback
Direct Known Subclasses:
AsyncMcpResourceMethodCallback.Builder, AsyncStatelessMcpResourceMethodCallback.Builder, SyncMcpResourceMethodCallback.Builder, SyncStatelessMcpResourceMethodCallback.Builder
Enclosing class:
AbstractMcpResourceMethodCallback

protected abstract static class AbstractMcpResourceMethodCallback.AbstractBuilder<T extends AbstractMcpResourceMethodCallback.AbstractBuilder<T,R>,R> extends Object
Abstract builder for creating McpResourceMethodCallback instances.

This builder provides a base for constructing callback instances with the required parameters.

  • Field Details

  • Constructor Details

    • AbstractBuilder

      protected AbstractBuilder()
  • Method Details

    • method

      public T method(Method method)
      Set the method to create a callback for.
      Parameters:
      method - The method to create a callback for
      Returns:
      This builder
    • bean

      public T bean(Object bean)
      Set the bean instance that contains the method.
      Parameters:
      bean - The bean instance
      Returns:
      This builder
    • uri

      public T uri(String uri)
      Set the URI for the resource.
      Parameters:
      uri - The URI for the resource
      Returns:
      This builder
    • resource

      public T resource(io.modelcontextprotocol.spec.McpSchema.Resource resource)
      Set the Mcp Schema resource.
      Parameters:
      resource - The resource
      Returns:
      This builder
    • resource

      public T resource(io.modelcontextprotocol.spec.McpSchema.ResourceTemplate resourceTemplate)
      Set the Mcp Schema resource template.
      Parameters:
      resourceTemplate - The resource template
      Returns:
      This builder
    • resultConverter

      public T resultConverter(McpReadResourceResultConverter resultConverter)
      Set the result converter.
      Parameters:
      resultConverter - The result converter
      Returns:
      This builder
    • uriTemplateManagerFactory

      public T uriTemplateManagerFactory(io.modelcontextprotocol.util.McpUriTemplateManagerFactory uriTemplateManagerFactory)
      Set the URI template manager factory.
      Parameters:
      uriTemplateManagerFactory - The URI template manager factory
      Returns:
      This builder
    • contentType

      public T contentType(AbstractMcpResourceMethodCallback.ContentType contentType)
      Set the content type.
      Parameters:
      contentType - The content type
      Returns:
      This builder
    • name

      public T name(String name)
      Set the name of the resource.
      Parameters:
      name - The name of the resource
      Returns:
      This builder
    • description

      public T description(String description)
      Set the description of the resource.
      Parameters:
      description - The description of the resource
      Returns:
      This builder
    • mimeType

      public T mimeType(String mimeType)
      Set the MIME type of the resource.
      Parameters:
      mimeType - The MIME type of the resource
      Returns:
      This builder
    • validate

      protected void validate()
      Validate the builder state.
      Throws:
      IllegalArgumentException - if the builder state is invalid
    • build

      public abstract R build()
      Build the callback.
      Returns:
      A new callback instance