public class DefaultNameInclusionStrategy extends Object implements SerializationStrategy
| Constructor and Description |
|---|
DefaultNameInclusionStrategy(String... includes)
Whitelists method names.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(String... identifiers)
Adds identifiers to the exclusion strategy.
|
boolean |
contains(String identifier)
Checks if an identifier is contained in this strategy.
|
boolean |
exclude(String identifier)
Checks if the given identifier should be excluded.
|
boolean |
include(String identifier)
Checks if the given identifier should be included.
|
void |
remove(String... identifiers)
Removes identifiers from the serialization strategy.
|
boolean |
shouldSkipClass(Class<?> aClass)
Skips no classes.
|
boolean |
shouldSkipField(com.google.gson.FieldAttributes fieldAttributes)
Skips all fields if their names are not contained in the whitelist.
|
String |
toString()
Returns an explanation how this strategy works.
|
public DefaultNameInclusionStrategy(String... includes)
includes - names to whitelist.public boolean shouldSkipField(com.google.gson.FieldAttributes fieldAttributes)
shouldSkipField in interface com.google.gson.ExclusionStrategyfieldAttributes - the field attributespublic boolean shouldSkipClass(Class<?> aClass)
shouldSkipClass in interface com.google.gson.ExclusionStrategyaClass - the class typespublic void add(String... identifiers)
add in interface SerializationStrategyidentifiers - the modifiers to be added.public void remove(String... identifiers)
remove in interface SerializationStrategyidentifiers - the modifiers to be removed.public boolean contains(String identifier)
contains in interface SerializationStrategyidentifier - the identifier to be checked.public boolean include(String identifier)
include in interface SerializationStrategyidentifier - the identifier to be checked.public boolean exclude(String identifier)
exclude in interface SerializationStrategyidentifier - the identifier to be checked.Copyright © 2016. All rights reserved.