Java Map Put putClassToMap(String extensionId, String key, Class className)

Here you can find the source of putClassToMap(String extensionId, String key, Class className)

Description

put Class To Map

License

Open Source License

Declaration

private static void putClassToMap(String extensionId, String key, Class<?> className) 

Method Source Code

//package com.java2s;
/**/*from  ww w  .  j av a  2  s . co m*/
 * Copyright (C) 2015 ZTE, Inc. and others. All rights reserved. (ZTE)
 *
 * 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.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Main {
    private static Map<String, Map<String, List<Class<?>>>> extensionClassMap;

    private static void putClassToMap(String extensionId, String key, Class<?> className) {
        Map<String, List<Class<?>>> map;
        if (!extensionClassMap.containsKey(extensionId)) {
            map = new HashMap<String, List<Class<?>>>();
            extensionClassMap.put(extensionId, map);
        } else {
            map = extensionClassMap.get(extensionId);
        }
        List<Class<?>> classList;
        if (map.containsKey(key)) {
            classList = map.get(key);
        } else {
            classList = new ArrayList<Class<?>>();
            map.put(key, classList);
        }
        classList.add(className);
    }
}

Related

  1. putAsStringIfNotNull(Map properties, String key, Object value)
  2. putAt(LinkedHashMap map, K key, V value, int pos)
  3. putBoolean(Map properties, Object key, boolean value)
  4. putByFullKey(Map map, String key, Object value)
  5. putCheckedObjectInInnerMap(Map> mapValues, A key, K innerKey, V obj)
  6. putData(Map data, String name, Object value)
  7. putDataInToMap(String className, String MethodName)
  8. putDeepValue(Map map, String keyPath, T v)
  9. putIfAbsent(final Map from, final Map to)