Java ConcurrentMap clearClassMapping()

Here you can find the source of clearClassMapping()

Description

clear Class Mapping

License

Apache License

Declaration

public static void clearClassMapping() 

Method Source Code

//package com.java2s;
/*//  w ww. j av a2 s  .c om
 * 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.HashMap;

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 clearClassMapping() {
        mappings.clear();
        addBaseClassMappings();
    }

    public static void addBaseClassMappings() {
        mappings.put("byte", byte.class);
        mappings.put("short", short.class);
        mappings.put("int", int.class);
        mappings.put("long", long.class);
        mappings.put("float", float.class);
        mappings.put("double", double.class);
        mappings.put("boolean", boolean.class);
        mappings.put("char", char.class);

        mappings.put("[byte", byte[].class);
        mappings.put("[short", short[].class);
        mappings.put("[int", int[].class);
        mappings.put("[long", long[].class);
        mappings.put("[float", float[].class);
        mappings.put("[double", double[].class);
        mappings.put("[boolean", boolean[].class);
        mappings.put("[char", char[].class);

        mappings.put(HashMap.class.getName(), HashMap.class);
    }
}

Related

  1. addClassMapping(String className, Class clazz)
  2. addConcurrent(K key, C values, ConcurrentMap map)
  3. addIfAbsent(K key, ConcurrentMap map, Object value)
  4. clearDefaultResourceBundles()
  5. create(boolean sorted)
  6. createConcurrentMap()
  7. createConcurrentMap()