mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix comment
This commit is contained in:
parent
fd3ff4d2ee
commit
0943c3ccab
@ -16,21 +16,7 @@ import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* JSON的值自定义写出,通过自定义实现此接口,实现对象自定义写出字符串形式<br>
|
||||
* 如自定义的一个CustomBean,我只希望输出id的值,此时自定义此接口:
|
||||
* <pre>{@code
|
||||
* GlobalValueWriters.add(new JSONValueWriter() {
|
||||
* @Override
|
||||
* public boolean test(final Object value) {
|
||||
* return value instanceof CustomBean;
|
||||
* }
|
||||
*
|
||||
* @Override
|
||||
* public void write(final JSONWriter writer, final Object value) {
|
||||
* writer.writeRaw(String.valueOf(((CustomBean)value).getId()));
|
||||
* }
|
||||
* });
|
||||
* }</pre>
|
||||
*
|
||||
* 如自定义的一个CustomBean,我只希望输出id的值,此时自定义此接口。<br>
|
||||
* 其中{@link JSONValueWriter#test(Object)}负责判断何种对象使用此规则,{@link JSONValueWriter#write(JSONWriter, Object)}负责写出规则。<br>
|
||||
* 注意:使用{@link GlobalValueWriters#add(JSONValueWriter)}加入全局转换规则后,在JSON对象中,自定义对象不会被转换,而是原始对象存在。
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user