public class FastJsonPropertyPreFilter
extends java.lang.Object
implements com.alibaba.fastjson.serializer.PropertyPreFilter
Extend the function of SimplePropertyPreFilter
so it can properly handle the property filters defined with hierarchies, e.g. “foo.bar.name”
Modifier and Type | Field and Description |
---|---|
static java.util.regex.Pattern |
PROPERTY_SEPARATOR
The properties separator pattern
[,;:]+ |
Constructor and Description |
---|
FastJsonPropertyPreFilter(java.lang.String... properties) |
Modifier and Type | Method and Description |
---|---|
void |
addExcludes(java.util.Set<java.lang.String> properties)
Add name/path of the properties to be banned
|
void |
addExcludes(java.lang.String... properties)
Add name/path of the properties to be banned
|
void |
addIncludes(java.util.Collection<java.lang.String> properties)
Add name/path of the properties to be exported
|
void |
addIncludes(java.lang.String... properties)
Add name/path of the properties to be exported
|
boolean |
apply(com.alibaba.fastjson.serializer.JSONSerializer serializer,
java.lang.Object source,
java.lang.String name) |
static boolean |
hasPattern(java.util.Collection<java.lang.String> paths) |
void |
setFullPaths(java.util.List<java.lang.String> ls) |
public static final java.util.regex.Pattern PROPERTY_SEPARATOR
The properties separator pattern [,;:]+
public FastJsonPropertyPreFilter(java.lang.String... properties)
public void setFullPaths(java.util.List<java.lang.String> ls)
public void addIncludes(java.lang.String... properties)
Add name/path of the properties to be exported
It supports adding multiple properties in one string separated by the PROPERTY_SEPARATOR
It can add a multiple level path separated by “.
” or “/
e.g. ”foo/bar
“ or ”foo.bar
"
properties
- the propertiespublic void addIncludes(java.util.Collection<java.lang.String> properties)
Add name/path of the properties to be exported
It supports adding multiple properties in one string separated by the PROPERTY_SEPARATOR
It can add a multiple level path separated by “.
” or “/
e.g. ”foo/bar
“ or ”foo.bar
"
properties
- the propertiespublic void addExcludes(java.lang.String... properties)
Add name/path of the properties to be banned
It supports adding multiple properties in one string separated by the PROPERTY_SEPARATOR
It can add a multiple level path separated by “.
” or “/
e.g. ”foo/bar
“ or ”foo.bar
"
properties
- the propertiespublic void addExcludes(java.util.Set<java.lang.String> properties)
Add name/path of the properties to be banned
It supports adding multiple properties in one string separated by the PROPERTY_SEPARATOR
It can add a multiple level path separated by “.
” or “/
e.g. ”foo/bar
“ or ”foo.bar
"
properties
- the propertiespublic boolean apply(com.alibaba.fastjson.serializer.JSONSerializer serializer, java.lang.Object source, java.lang.String name)
apply
in interface com.alibaba.fastjson.serializer.PropertyPreFilter
public static boolean hasPattern(java.util.Collection<java.lang.String> paths)
Copyright © 2014–2017 ActFramework. All rights reserved.