All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kiwiproject.json.PropertyMaskingOptions Maven / Gradle / Ivy

Go to download

Kiwi is a utility library. We really like Google's Guava, and also use Apache Commons. But if they don't have something we need, and we think it is useful, this is where we put it.

There is a newer version: 4.5.2
Show newest version
package org.kiwiproject.json;

import lombok.Builder;
import lombok.Getter;
import lombok.NonNull;

import java.util.ArrayList;
import java.util.List;

/**
 * Options for {@link PropertyMaskingSafePropertyWriter} and {@link KiwiJacksonSerializers}.
 */
@Builder
@Getter
public class PropertyMaskingOptions {

    private static final String DEFAULT_MASK_TEXT_REPLACEMENT = "********";
    private static final String DEFAULT_FAILED_TEXT_REPLACEMENT = "(unable to serialize field)";

    /**
     * Regular expressions that define that field names to be masked, e.g. {@code .*password.*} (note the comparisons
     * will be case insensitive). Must not be {@code null}, but can be empty. Default is empty.
     */
    @NonNull
    @Builder.Default
    List maskedFieldRegexps = new ArrayList<>();

    /**
     * The replacement text for masked field values. Can be {@code null}.
     */
    @Builder.Default
    String maskedFieldReplacementText = DEFAULT_MASK_TEXT_REPLACEMENT;

    /**
     * The replacement text for serialization errors. Can be {@code null}.
     */
    @Builder.Default
    String serializationErrorReplacementText = DEFAULT_FAILED_TEXT_REPLACEMENT;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy