Package org.a2aproject.sdk.server.util
Class ArtifactUtils
java.lang.Object
org.a2aproject.sdk.server.util.ArtifactUtils
Utility functions for creating A2A Artifact objects.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ArtifactnewArtifact(String name, List<Part<?>> parts) Creates a new Artifact object with empty description.static ArtifactnewArtifact(String name, List<Part<?>> parts, @Nullable String description) Creates a new Artifact object.static ArtifactnewDataArtifact(String name, Object data) Creates a new Artifact object containing only a single DataPart with empty description.static ArtifactnewDataArtifact(String name, Object data, @Nullable String description) Creates a new Artifact object containing only a single DataPart.static ArtifactnewTextArtifact(String name, String text) Creates a new Artifact object containing only a single TextPart with empty description.static ArtifactnewTextArtifact(String name, String text, @Nullable String description) Creates a new Artifact object containing only a single TextPart.
-
Method Details
-
newArtifact
Creates a new Artifact object.- Parameters:
name- The human-readable name of the artifact.parts- The list ofPartobjects forming the artifact's content.description- An optional description of the artifact.- Returns:
- A new
Artifactobject with a generated artifact_id.
-
newArtifact
Creates a new Artifact object with empty description.- Parameters:
name- The human-readable name of the artifact.parts- The list ofPartobjects forming the artifact's content.- Returns:
- A new
Artifactobject with a generated artifact_id.
-
newTextArtifact
Creates a new Artifact object containing only a single TextPart.- Parameters:
name- The human-readable name of the artifact.text- The text content of the artifact.description- An optional description of the artifact.- Returns:
- A new
Artifactobject with a generated artifact_id.
-
newTextArtifact
Creates a new Artifact object containing only a single TextPart with empty description.- Parameters:
name- The human-readable name of the artifact.text- The text content of the artifact.- Returns:
- A new
Artifactobject with a generated artifact_id.
-
newDataArtifact
Creates a new Artifact object containing only a single DataPart.Supports any JSON value type: objects (Map), arrays (List), primitives (String, Number, Boolean), or null.
- Parameters:
name- The human-readable name of the artifact.data- The structured data content of the artifact (JSON object, array, primitive, or null).description- An optional description of the artifact.- Returns:
- A new
Artifactobject with a generated artifact_id.
-
newDataArtifact
Creates a new Artifact object containing only a single DataPart with empty description.Supports any JSON value type: objects (Map), arrays (List), primitives (String, Number, Boolean), or null.
- Parameters:
name- The human-readable name of the artifact.data- The structured data content of the artifact (JSON object, array, primitive, or null).- Returns:
- A new
Artifactobject with a generated artifact_id.
-