Java ConcurrentMap addClassMapping(String className, Class clazz)

Here you can find the source of addClassMapping(String className, Class clazz)

Description

add Class Mapping

License

Apache License

Declaration

public static void addClassMapping(String className, Class<?> clazz) 

Method Source Code

//package com.java2s;
/*/* w  ww .  j  a v a  2 s.  c  o  m*/
 * Copyright 1999-2101 Alibaba Group.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

public class Main {
    private static ConcurrentMap<String, Class<?>> mappings = new ConcurrentHashMap<String, Class<?>>();

    public static void addClassMapping(String className, Class<?> clazz) {
        if (className == null) {
            className = clazz.getName();
        }

        mappings.put(className, clazz);
    }
}

Related

  1. addConcurrent(K key, C values, ConcurrentMap map)
  2. addIfAbsent(K key, ConcurrentMap map, Object value)
  3. clearClassMapping()
  4. clearDefaultResourceBundles()