Skip to content

Commit 82259bd

Browse files
committed
cleanup
1 parent f429a45 commit 82259bd

File tree

5 files changed

+54
-2
lines changed

5 files changed

+54
-2
lines changed

mcp-json-jackson/src/main/java/io/modelcontextprotocol/json/jackson/JacksonMcpJsonMapper.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

mcp-json-jackson/src/main/java/io/modelcontextprotocol/json/jackson/JacksonMcpJsonMapperSupplier.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,20 @@
33
import io.modelcontextprotocol.json.McpJsonMapper;
44
import 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+
*/
611
public 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());

mcp-json-jackson/src/main/java/io/modelcontextprotocol/json/schema/jackson/JacksonJsonSchemaValidatorSupplier.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,21 @@
33
import io.modelcontextprotocol.json.schema.JsonSchemaValidator;
44
import 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+
*/
613
public 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();

mcp-json/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
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>

mcp-json/src/main/java/io/modelcontextprotocol/json/TypeRef.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff 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&lt;List&lt;Foo&gt;&gt; ref = new TypeRef&lt;&gt;(){};
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
}

0 commit comments

Comments
 (0)