public static AttributeMerger getAttributeMerger(final PrincipalAttributesCoreProperties.MergingStrategyTypes mergingPolicy) {
        switch (mergingPolicy) {
            case MULTIVALUED -> {
                val merger = new MultivaluedAttributeMerger();
                merger.setDistinctValues(true);
                return merger;
            }
            case ADD -> {
                return new NoncollidingAttributeAdder();
            }
            case SOURCE -> {
                return new ReturnOriginalAttributeMerger();
            }
            case DESTINATION -> {
                return new ReturnChangesAttributeMerger();
            }
            default -> {
                return new ReplacingAttributeAdder();
            }
        }
    }
Gets attribute merger.

@param mergingPolicy the merging policy
@return the attribute merger
core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/CoreAuthenticationUtils.java