Package com.tnsai.agents.output
Class AgentOutputFormatter
java.lang.Object
com.tnsai.agents.output.AgentOutputFormatter
Handles output formatting and serialization for an Agent.
This class extracts output formatting concerns from the Agent class:
- Serializing data to various formats (JSON, YAML, XML, etc.)
- Auto-detecting format from annotations
- Custom format registration
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondetectOutputFormat(Class<?> clazz) Detects the output format from class annotations.Serializes an object using annotation-detected format or JSON default.serialize(Object data, OutputFormat format) Serializes an object using the specified output format.
-
Constructor Details
-
AgentOutputFormatter
public AgentOutputFormatter()
-
-
Method Details
-
serialize
Serializes an object using the specified output format.- Parameters:
data- The data to serializeformat- The output format- Returns:
- Serialized string
-
serialize
Serializes an object using annotation-detected format or JSON default.- Parameters:
data- The data to serialize- Returns:
- Serialized string
-
detectOutputFormat
Detects the output format from class annotations.- Parameters:
clazz- The class to inspect- Returns:
- Detected format, or JSON as default
-