public abstract static class JSONObfuscator.Builder extends Object
JSONObfuscators.| Modifier and Type | Method and Description |
|---|---|
JSONObfuscator.Builder |
allByDefault()
Indicates that by default properties will be obfuscated if they are JSON objects or arrays (default).
|
abstract JSONObfuscator |
build()
Creates a new
JSONObfuscator with the properties and obfuscators added to this builder. |
abstract JSONObfuscator.Builder |
caseInsensitiveByDefault()
Sets the default case sensitivity for new properties to
CaseSensitivity.CASE_INSENSITIVE. |
abstract JSONObfuscator.Builder |
caseSensitiveByDefault()
Sets the default case sensitivity for new properties to
CaseSensitivity.CASE_SENSITIVE. |
abstract JSONObfuscator.Builder |
excludeArraysByDefault()
Indicates that by default properties will not be obfuscated if they are JSON arrays.
|
abstract JSONObfuscator.Builder |
excludeObjectsByDefault()
Indicates that by default properties will not be obfuscated if they are JSON objects.
|
abstract JSONObfuscator.Builder |
includeArraysByDefault()
Indicates that by default properties will be obfuscated if they are JSON arrays (default).
|
abstract JSONObfuscator.Builder |
includeObjectsByDefault()
Indicates that by default properties will be obfuscated if they are JSON objects (default).
|
abstract JSONObfuscator.Builder |
produceValidJSON()
If called, obfuscation produces valid JSON, provided the input is valid JSON.
|
JSONObfuscator.Builder |
scalarsOnlyByDefault()
Indicates that by default properties will not be obfuscated if they are JSON objects or arrays.
|
<R> R |
transform(Function<? super JSONObfuscator.Builder,? extends R> f)
This method allows the application of a function to this builder.
|
abstract JSONObfuscator.Builder |
withMalformedJSONWarning(String warning)
Sets the warning to include if a
JsonParsingException is thrown. |
abstract JSONObfuscator.Builder |
withPrettyPrinting(boolean prettyPrint)
Sets whether or not to pretty-print obfuscated JSON.
|
abstract JSONObfuscator.PropertyConfigurer |
withProperty(String property,
Obfuscator obfuscator)
Adds a property to obfuscate.
|
abstract JSONObfuscator.PropertyConfigurer |
withProperty(String property,
Obfuscator obfuscator,
CaseSensitivity caseSensitivity)
Adds a property to obfuscate.
|
public abstract JSONObfuscator.PropertyConfigurer withProperty(String property, Obfuscator obfuscator)
withProperty(String, Obfuscator, CaseSensitivity) with the last specified default case sensitivity
using caseSensitiveByDefault() or caseInsensitiveByDefault(). The default is CaseSensitivity.CASE_SENSITIVE.property - The name of the property.obfuscator - The obfuscator to use for obfuscating the property.JSONObfuscators.NullPointerException - If the given property name or obfuscator is null.IllegalArgumentException - If a property with the same name and the same case sensitivity was already added.public abstract JSONObfuscator.PropertyConfigurer withProperty(String property, Obfuscator obfuscator, CaseSensitivity caseSensitivity)
property - The name of the property.obfuscator - The obfuscator to use for obfuscating the property.caseSensitivity - The case sensitivity for the property.JSONObfuscators.NullPointerException - If the given property name, obfuscator or case sensitivity is null.IllegalArgumentException - If a property with the same name and the same case sensitivity was already added.public abstract JSONObfuscator.Builder caseSensitiveByDefault()
CaseSensitivity.CASE_SENSITIVE. This is the default setting.
Note that this will not change the case sensitivity of any property that was already added.
public abstract JSONObfuscator.Builder caseInsensitiveByDefault()
CaseSensitivity.CASE_INSENSITIVE.
Note that this will not change the case sensitivity of any property that was already added.
public JSONObfuscator.Builder scalarsOnlyByDefault()
excludeObjectsByDefault() and excludeArraysByDefault().
Note that this will not change what will be obfuscated for any property that was already added.
public abstract JSONObfuscator.Builder excludeObjectsByDefault()
JSONObfuscator.PropertyConfigurer.includeObjects()
Note that this will not change what will be obfuscated for any property that was already added.
public abstract JSONObfuscator.Builder excludeArraysByDefault()
JSONObfuscator.PropertyConfigurer.includeArrays()
Note that this will not change what will be obfuscated for any property that was already added.
public JSONObfuscator.Builder allByDefault()
includeObjectsByDefault() and includeArraysByDefault().
Note that this will not change what will be obfuscated for any property that was already added.
public abstract JSONObfuscator.Builder includeObjectsByDefault()
JSONObfuscator.PropertyConfigurer.excludeObjects()
Note that this will not change what will be obfuscated for any property that was already added.
public abstract JSONObfuscator.Builder includeArraysByDefault()
JSONObfuscator.PropertyConfigurer.excludeArrays()
Note that this will not change what will be obfuscated for any property that was already added.
public abstract JSONObfuscator.Builder withPrettyPrinting(boolean prettyPrint)
true.prettyPrint - true to pretty-print obfuscated JSON, or false otherwise.public abstract JSONObfuscator.Builder produceValidJSON()
An exception is made for Obfuscator.none(). This still allows skipping obfuscating values inside certain properties.
Note that if obfuscated objects or arrays are converted to strings, any line breaks that remain after obfuscation will be escaped.
public abstract JSONObfuscator.Builder withMalformedJSONWarning(String warning)
JsonParsingException is thrown.
This can be used to override the default message. Use null to omit the warning.warning - The warning to include.public <R> R transform(Function<? super JSONObfuscator.Builder,? extends R> f)
Any exception thrown by the function will be propagated to the caller.
R - The type of the result of the function.f - The function to apply.public abstract JSONObfuscator build()
JSONObfuscator with the properties and obfuscators added to this builder.JSONObfuscator.Copyright © 2020–2021. All rights reserved.