You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class ListIntReader implements ObjectReader<Object> {
public static final ListIntReader INSTANCE = new ListIntReader();
@Override
public Object readObject(JSONReader jsonReader, Type fieldType, Object fieldName, long features) {
System.out.println("ListInt.Reader");
return null;
}
}
TextEntity.java
public class TextEntity {
@JSONField(deserializeUsing = ListIntReader.class, serializeUsing = ListIntWriter.class)
private List<Integer> idList;
public static void main(String[] args) {
String body = "{\"idList\":[1,2,3]}";
TextEntity textEntity = JSON.parseObject(body , TextEntity.class, JSONReader.Feature.FieldBased);
System.out.println();
}
}
ListIntReader.java
TextEntity.java
上述该示例,我在
TextEntity.java
中idList
字段上,使用了JSONField该注解,并指定了序列化的反序列化自定义的使用,@JSONField(deserializeUsing = ListIntReader.class, serializeUsing = ListIntWriter.class)
但实际运行时,无法去执行
ListIntReader.java
中的打印操作。如果我想实现针对该类型中该字段定制个性化序例化的效果,我该怎么操作?
The text was updated successfully, but these errors were encountered: