001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache license, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the license for the specific language governing permissions and
015 * limitations under the license.
016 */
017package org.apache.logging.log4j.spi;
018
019import java.util.Map;
020
021/**
022 * Extension service provider interface to allow putting Object values in the
023 * {@link org.apache.logging.log4j.ThreadContext}.
024 *
025 * @see ThreadContextMap
026 * @since 2.8
027 */
028public interface ObjectThreadContextMap extends CleanableThreadContextMap {
029
030    /**
031     * Returns the Object value for the specified key, or {@code null} if the specified key does not exist in this
032     * collection.
033     *
034     * @param key the key whose value to return
035     * @return the value for the specified key or {@code null}
036     */
037    <V> V getValue(String key);
038
039    /**
040     * Puts the specified key-value pair into the collection.
041     *
042     * @param key the key to add or remove. Keys may be {@code null}.
043     * @param value the value to add. Values may be {@code null}.
044     */
045    <V> void putValue(String key, V value);
046
047    /**
048     * Puts all given key-value pairs into the collection.
049     *
050     * @param values the map of key-value pairs to add
051     */
052    <V> void putAllValues(Map<String, V> values);
053
054}