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.serializers.CollectionSerializer;
017import org.slf4j.event.KeyValuePair;
018
019import java.util.ArrayList;
020
021public class KeyValuePairCollectionSerializerV5 extends CollectionSerializer<ArrayList<KeyValuePair>> {
022
023    private final KeyValuePairSerializerV5 keyValuePairSerializer;
024
025    public KeyValuePairCollectionSerializerV5(int stringCapacity) {
026        this(new KeyValuePairSerializerV5(stringCapacity));
027    }
028
029    public KeyValuePairCollectionSerializerV5(KeyValuePairSerializerV5 keyValuePairSerializer) {
030        super();
031        if (keyValuePairSerializer == null) {
032            throw new IllegalArgumentException("KeyValuePairSerializer cannot be null");
033        }
034        this.keyValuePairSerializer = keyValuePairSerializer;
035        setElementClass(KeyValuePair.class, keyValuePairSerializer);
036        setElementsCanBeNull(true);
037    }
038
039    public KeyValuePairSerializerV5 getElementSerializerV5() {
040        return keyValuePairSerializer;
041    }
042}