File tree Expand file tree Collapse file tree 5 files changed +54
-2
lines changed
mcp-json-jackson/src/main/java/io/modelcontextprotocol/json
src/main/java/io/modelcontextprotocol/json Expand file tree Collapse file tree 5 files changed +54
-2
lines changed Original file line number Diff line number Diff line change @@ -15,13 +15,25 @@ public final class JacksonMcpJsonMapper implements McpJsonMapper {
15
15
16
16
private final ObjectMapper objectMapper ;
17
17
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
+ */
18
25
public JacksonMcpJsonMapper (ObjectMapper objectMapper ) {
19
26
if (objectMapper == null ) {
20
27
throw new IllegalArgumentException ("ObjectMapper must not be null" );
21
28
}
22
29
this .objectMapper = objectMapper ;
23
30
}
24
31
32
+ /**
33
+ * Returns the underlying Jackson {@link ObjectMapper} used for JSON serialization and deserialization.
34
+ *
35
+ * @return the ObjectMapper instance
36
+ */
25
37
public ObjectMapper getObjectMapper () {
26
38
return objectMapper ;
27
39
}
Original file line number Diff line number Diff line change 3
3
import io .modelcontextprotocol .json .McpJsonMapper ;
4
4
import io .modelcontextprotocol .json .McpJsonMapperSupplier ;
5
5
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
+ */
6
11
public class JacksonMcpJsonMapperSupplier implements McpJsonMapperSupplier {
7
12
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
+ */
8
20
@ Override
9
21
public McpJsonMapper get () {
10
22
return new JacksonMcpJsonMapper (new com .fasterxml .jackson .databind .ObjectMapper ());
Original file line number Diff line number Diff line change 3
3
import io .modelcontextprotocol .json .schema .JsonSchemaValidator ;
4
4
import io .modelcontextprotocol .json .schema .JsonSchemaValidatorSupplier ;
5
5
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
+ */
6
13
public class JacksonJsonSchemaValidatorSupplier implements JsonSchemaValidatorSupplier {
7
14
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
+ */
8
21
@ Override
9
22
public JsonSchemaValidator get () {
10
23
return new DefaultJsonSchemaValidator ();
Original file line number Diff line number Diff line change 10
10
</parent >
11
11
<artifactId >mcp-json</artifactId >
12
12
<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 >
15
15
<url >https://github.com/modelcontextprotocol/java-sdk</url >
16
16
<scm >
17
17
<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> {
11
11
12
12
private final Type type ;
13
13
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
+ */
14
24
protected TypeRef () {
15
25
Type superClass = getClass ().getGenericSuperclass ();
16
26
if (superClass instanceof Class ) {
@@ -19,6 +29,11 @@ protected TypeRef() {
19
29
this .type = ((ParameterizedType ) superClass ).getActualTypeArguments ()[0 ];
20
30
}
21
31
32
+ /**
33
+ * Returns the captured type information.
34
+ *
35
+ * @return the Type representing the actual type argument captured by this TypeRef instance
36
+ */
22
37
public Type getType () {
23
38
return type ;
24
39
}
You can’t perform that action at this time.
0 commit comments