Package dev.tachyonmcp.core.server.json
Class Jackson3JsonFactory
java.lang.Object
dev.tachyonmcp.core.server.json.Jackson3JsonFactory
- All Implemented Interfaces:
JsonDocumentFactory<String>,JsonSchemaFactory<String>
public final class Jackson3JsonFactory
extends Object
implements JsonDocumentFactory<String>, JsonSchemaFactory<String>
Jackson 3-backed
JsonDocumentFactory and JsonSchemaFactory for String
sources: parses the source and rejects malformed JSON before wrapping it.
Registered via ServiceLoader in META-INF/services (discovered
through its public no-arg constructor, not INSTANCE — the module isn't an explicit
module, so ServiceLoader never looks for a provider() factory method). For
already-parsed Jackson JsonNode trees or tachyon's provider-neutral JsonObject,
see JacksonNodeJsonFactory and JacksonObjectJsonFactory — a single class can't
implement JsonSchemaFactory<String> and JsonSchemaFactory<JsonNode> at once, since
Java forbids implementing the same generic interface twice with different type arguments.
- Author:
- Konstantin Pavlov
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the source type this factory accepts.toJsonDocument(String json) Creates a document fromsource.toJsonSchema(String json) Creates a schema fromsource.
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
Jackson3JsonFactory
public Jackson3JsonFactory()
-
-
Method Details
-
sourceType
Description copied from interface:JsonDocumentFactoryReturns the source type this factory accepts.- Specified by:
sourceTypein interfaceJsonDocumentFactory<String>- Specified by:
sourceTypein interfaceJsonSchemaFactory<String>- Returns:
- the source type
-
toJsonDocument
Description copied from interface:JsonDocumentFactoryCreates a document fromsource.- Specified by:
toJsonDocumentin interfaceJsonDocumentFactory<String>- Parameters:
json- the source representation- Returns:
- the parsed document
-
toJsonSchema
Description copied from interface:JsonSchemaFactoryCreates a schema fromsource.- Specified by:
toJsonSchemain interfaceJsonSchemaFactory<String>- Parameters:
json- the source representation- Returns:
- the parsed schema
-