001/* 002 * Logback: the reliable, generic, fast and flexible logging framework. 003 * Copyright (C) 1999-2026, QOS.ch. All rights reserved. 004 * 005 * This program and the accompanying materials are dual-licensed under 006 * either the terms of the Eclipse Public License v2.0 as published by 007 * the Eclipse Foundation 008 * 009 * or (per the licensee's choosing) 010 * 011 * under the terms of the GNU Lesser General Public License version 2.1 012 * as published by the Free Software Foundation. 013 */ 014package ch.qos.logback.classic.kryo; 015 016import com.esotericsoftware.kryo.kryo5.Serializer; 017 018/** 019 * V5 MDC map: whole-map cache is {@link BiMapType#IDENTITY}. Keys stay on {@link BasicStringSerializer}. 020 * Values use the caller-supplied codec, the same 021 * {@link MultiEventCompressedStringSerializer} as message, string arguments, and 022 * KVP string values. 023 */ 024public class MDCPropertyMapSerializerV5 extends MDCPropertyMapSerializer { 025 026 public MDCPropertyMapSerializerV5(Serializer<String> valueSerializer) { 027 this(1024, valueSerializer); 028 } 029 030 public MDCPropertyMapSerializerV5(int capacity, Serializer<String> valueSerializer) { 031 super(BiMapType.IDENTITY, capacity, new BasicStringSerializer(capacity), requireValueSerializer(valueSerializer)); 032 } 033 034 private static Serializer<String> requireValueSerializer(Serializer<String> valueSerializer) { 035 if (valueSerializer == null) { 036 throw new IllegalArgumentException("valueSerializer cannot be null"); 037 } 038 return valueSerializer; 039 } 040}