public class Sanitizer extends Object
Constructor and Description |
---|
Sanitizer()
Create a new
Sanitizer instance with a default set of keys to sanitize. |
Sanitizer(Iterable<SanitizingFunction> sanitizingFunctions)
Create a new
Sanitizer instance with a default set of keys to sanitize and
additional sanitizing functions. |
Sanitizer(Iterable<SanitizingFunction> sanitizingFunctions,
String... keysToSanitize)
Create a new
Sanitizer instance with specific keys to sanitize and
additional sanitizing functions. |
Sanitizer(String... keysToSanitize)
Create a new
Sanitizer instance with specific keys to sanitize. |
Modifier and Type | Method and Description |
---|---|
void |
keysToSanitize(String... keysToSanitize)
Adds keys that should be sanitized.
|
Object |
sanitize(SanitizableData data)
Sanitize the value from the given
SanitizableData using the available
SanitizingFunction s. |
Object |
sanitize(String key,
Object value)
Sanitize the given value if necessary.
|
void |
setKeysToSanitize(String... keysToSanitize)
Set the keys that should be sanitized, overwriting any existing configuration.
|
public Sanitizer()
Sanitizer
instance with a default set of keys to sanitize.public Sanitizer(String... keysToSanitize)
Sanitizer
instance with specific keys to sanitize.keysToSanitize
- the keys to sanitizepublic Sanitizer(Iterable<SanitizingFunction> sanitizingFunctions)
Sanitizer
instance with a default set of keys to sanitize and
additional sanitizing functions.sanitizingFunctions
- the sanitizing functions to applypublic Sanitizer(Iterable<SanitizingFunction> sanitizingFunctions, String... keysToSanitize)
Sanitizer
instance with specific keys to sanitize and
additional sanitizing functions.sanitizingFunctions
- the sanitizing functions to applykeysToSanitize
- the keys to sanitizepublic void setKeysToSanitize(String... keysToSanitize)
keysToSanitize
- the keys to sanitizepublic void keysToSanitize(String... keysToSanitize)
keysToSanitize
- the keys to sanitizepublic Object sanitize(String key, Object value)
key
- the key to sanitizevalue
- the valuepublic Object sanitize(SanitizableData data)
SanitizableData
using the available
SanitizingFunction
s.data
- the sanitizable data