Skip to content

Commit 195eae9

Browse files
author
Xizhi Xu
committed
Make codec encode generic
1 parent 35312b8 commit 195eae9

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

java/src/main/java/org/astonbitecode/j4rs/api/services/json/Codec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public interface Codec {
2222
<T> T decode(String json, String className) throws JsonCodecException;
2323

2424

25-
String encode(Object obj) throws JsonCodecException;
25+
<T> String encode(T obj) throws JsonCodecException;
2626

2727

2828
Object[] decodeArrayContents(String json) throws JsonCodecException;

java/src/main/java/org/astonbitecode/j4rs/api/value/JsonValueFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import org.astonbitecode.j4rs.api.JsonValue;
1818

1919
public class JsonValueFactory {
20-
public static JsonValue create(Object obj) {
20+
public static <T> JsonValue create(T obj) {
2121
return obj != null ? new JsonValueImpl(obj) : new NullJsonValueImpl();
2222
}
2323

java/src/main/java/org/astonbitecode/j4rs/api/value/JsonValueImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class JsonValueImpl implements JsonValue {
2727
@SuppressWarnings("unused")
2828
private String className;
2929

30-
JsonValueImpl(Object obj) {
30+
<T> JsonValueImpl(T obj) {
3131
this.jsonCodec = JsonCodecService.getJsonCodec();
3232
this.obj = obj;
3333
try {

0 commit comments

Comments
 (0)