Package org.a2aproject.sdk.spec
Class Artifact.Builder
java.lang.Object
org.a2aproject.sdk.spec.Artifact.Builder
- Enclosing class:
- Artifact
Builder for constructing immutable
Artifact instances.
The Builder provides a fluent API for creating artifacts with required and optional fields. Artifacts must have an artifactId and non-empty parts list.
Example usage:
Artifact result = Artifact.builder()
.artifactId("artifact-123")
.name("Analysis Report")
.description("Detailed analysis of user data")
.parts(List.of(new TextPart("Report content...", null)))
.build();
-
Method Summary
Modifier and TypeMethodDescriptionartifactId(String artifactId) Sets the unique identifier for this artifact.build()Builds a new immutableArtifactfrom the current builder state.description(@Nullable String description) Sets a brief description of the artifact's purpose or content.extensions(@Nullable List<String> extensions) Sets the list of protocol extensions used in this artifact.Sets additional metadata for the artifact.Sets the human-readable name of the artifact.Sets the content parts comprising the artifact.Sets the content parts from varargs.
-
Method Details
-
artifactId
Sets the unique identifier for this artifact.- Parameters:
artifactId- the artifact identifier (required)- Returns:
- this builder for method chaining
-
name
Sets the human-readable name of the artifact.- Parameters:
name- the artifact name (optional)- Returns:
- this builder for method chaining
-
description
Sets a brief description of the artifact's purpose or content.- Parameters:
description- the artifact description (optional)- Returns:
- this builder for method chaining
-
parts
Sets the content parts comprising the artifact.- Parameters:
parts- the list of content parts (required, must not be empty)- Returns:
- this builder for method chaining
-
parts
Sets the content parts from varargs.- Parameters:
parts- the content parts (required, must not be empty)- Returns:
- this builder for method chaining
-
metadata
Sets additional metadata for the artifact.- Parameters:
metadata- map of metadata key-value pairs (optional)- Returns:
- this builder for method chaining
-
extensions
Sets the list of protocol extensions used in this artifact.- Parameters:
extensions- the list of extension identifiers (optional)- Returns:
- this builder for method chaining
-
build
Builds a new immutableArtifactfrom the current builder state.- Returns:
- a new Artifact instance
- Throws:
IllegalArgumentException- if required fields are missing or parts is empty
-