File tree Expand file tree Collapse file tree
mcp-json-jackson/src/main/java/io/modelcontextprotocol/json
src/main/java/io/modelcontextprotocol/json Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,13 +15,25 @@ public final class JacksonMcpJsonMapper implements McpJsonMapper {
1515
1616 private final ObjectMapper objectMapper ;
1717
18+ /**
19+ * Constructs a new JacksonMcpJsonMapper instance with the given ObjectMapper.
20+ *
21+ * @param objectMapper the ObjectMapper to be used for JSON serialization and deserialization.
22+ * Must not be null.
23+ * @throws IllegalArgumentException if the provided ObjectMapper is null.
24+ */
1825 public JacksonMcpJsonMapper (ObjectMapper objectMapper ) {
1926 if (objectMapper == null ) {
2027 throw new IllegalArgumentException ("ObjectMapper must not be null" );
2128 }
2229 this .objectMapper = objectMapper ;
2330 }
2431
32+ /**
33+ * Returns the underlying Jackson {@link ObjectMapper} used for JSON serialization and deserialization.
34+ *
35+ * @return the ObjectMapper instance
36+ */
2537 public ObjectMapper getObjectMapper () {
2638 return objectMapper ;
2739 }
Original file line number Diff line number Diff line change 33import io .modelcontextprotocol .json .McpJsonMapper ;
44import io .modelcontextprotocol .json .McpJsonMapperSupplier ;
55
6+ /**
7+ * A supplier of {@link McpJsonMapper} instances that uses the Jackson library for JSON serialization and deserialization.
8+ * <p>
9+ * This implementation provides a {@link McpJsonMapper} backed by a Jackson {@link com.fasterxml.jackson.databind.ObjectMapper}.
10+ */
611public class JacksonMcpJsonMapperSupplier implements McpJsonMapperSupplier {
712
13+ /**
14+ * Returns a new instance of {@link McpJsonMapper} that uses the Jackson library for JSON serialization and deserialization.
15+ * <p>
16+ * The returned {@link McpJsonMapper} is backed by a new instance of {@link com.fasterxml.jackson.databind.ObjectMapper}.
17+ *
18+ * @return a new {@link McpJsonMapper} instance
19+ */
820 @ Override
921 public McpJsonMapper get () {
1022 return new JacksonMcpJsonMapper (new com .fasterxml .jackson .databind .ObjectMapper ());
Original file line number Diff line number Diff line change 33import io .modelcontextprotocol .json .schema .JsonSchemaValidator ;
44import io .modelcontextprotocol .json .schema .JsonSchemaValidatorSupplier ;
55
6+ /**
7+ * A concrete implementation of {@link JsonSchemaValidatorSupplier} that provides a
8+ * {@link JsonSchemaValidator} instance based on the Jackson library.
9+ *
10+ * @see JsonSchemaValidatorSupplier
11+ * @see JsonSchemaValidator
12+ */
613public class JacksonJsonSchemaValidatorSupplier implements JsonSchemaValidatorSupplier {
714
15+ /**
16+ * Returns a new instance of {@link JsonSchemaValidator} that uses the Jackson library
17+ * for JSON schema validation.
18+ *
19+ * @return A {@link JsonSchemaValidator} instance.
20+ */
821 @ Override
922 public JsonSchemaValidator get () {
1023 return new DefaultJsonSchemaValidator ();
Original file line number Diff line number Diff line change 1010 </parent >
1111 <artifactId >mcp-json</artifactId >
1212 <packaging >jar</packaging >
13- <name >Java MCP SDK JSON Schema </name >
14- <description >Java MCP SDK JSON Schema API</description >
13+ <name >Java MCP SDK JSON Support </name >
14+ <description >Java MCP SDK JSON Support API</description >
1515 <url >https://github.com/modelcontextprotocol/java-sdk</url >
1616 <scm >
1717 <url >https://github.com/modelcontextprotocol/java-sdk</url >
Original file line number Diff line number Diff line change @@ -11,6 +11,16 @@ public abstract class TypeRef<T> {
1111
1212 private final Type type ;
1313
14+ /**
15+ * Constructs a new TypeRef instance, capturing the generic type information
16+ * of the subclass. This constructor should be called from an anonymous subclass
17+ * to capture the actual type arguments. For example:
18+ * <pre>
19+ * TypeRef<List<Foo>> ref = new TypeRef<>(){};
20+ * </pre>
21+ *
22+ * @throws IllegalStateException if TypeRef is not subclassed with actual type information
23+ */
1424 protected TypeRef () {
1525 Type superClass = getClass ().getGenericSuperclass ();
1626 if (superClass instanceof Class ) {
@@ -19,6 +29,11 @@ protected TypeRef() {
1929 this .type = ((ParameterizedType ) superClass ).getActualTypeArguments ()[0 ];
2030 }
2131
32+ /**
33+ * Returns the captured type information.
34+ *
35+ * @return the Type representing the actual type argument captured by this TypeRef instance
36+ */
2237 public Type getType () {
2338 return type ;
2439 }
You can’t perform that action at this time.
0 commit comments