public class FastjsonPropertyFilter extends Object implements com.alibaba.fastjson.serializer.PropertyFilter
Object to json specified fields whether includes or excludes
Map<String, Object> map = ImmutableMap.of("a", 1, "b", true, "c", "x");
JSON.toJSONString(map, JsonPropertyFilter.include("a", "b"))
JSON.toJSONString(map, JsonPropertyFilter.exclude("a", "b"))
OR
JSON.toJSONString(map, new SimplePropertyPreFilter("a", "b"))
| 构造器和说明 |
|---|
FastjsonPropertyFilter(cn.ponfee.commons.json.FastjsonPropertyFilter.PropertyFilterType type,
boolean forceNonNull,
String... fields) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
apply(Object source,
String name,
Object value) |
static FastjsonPropertyFilter |
exclude(boolean forceNonNull,
String... fields) |
static FastjsonPropertyFilter |
exclude(String... fields) |
static FastjsonPropertyFilter |
include(boolean forceNonNull,
String... fields) |
static FastjsonPropertyFilter |
include(String... fields) |
public boolean apply(Object source, String name, Object value)
apply 在接口中 com.alibaba.fastjson.serializer.PropertyFilterpublic static FastjsonPropertyFilter exclude(@Nonnull String... fields)
public static FastjsonPropertyFilter exclude(boolean forceNonNull, @Nonnull String... fields)
public static FastjsonPropertyFilter include(@Nonnull String... fields)
public static FastjsonPropertyFilter include(boolean forceNonNull, @Nonnull String... fields)
Copyright © 2023. All rights reserved.