Java Class Load getClass(String fullClassName)

Here you can find the source of getClass(String fullClassName)

Description

Get the Class reference by the given fullClassName.

License

Apache License

Declaration

public static Class<?> getClass(String fullClassName) 

Method Source Code

//package com.java2s;
/**//from w w w.j a  v  a  2 s . c  om
 * <p>
 * This product is licensed under the Apache License,  Version 2.0, 
 * available at http://www.apache.org/licenses/LICENSE-2.0.
 * 
 * This product contains portions derived from Apache hadoop which is 
 * licensed under the Apache License, Version 2.0, available at 
 * http://hadoop.apache.org.
 * 
 * ? 2007 ? 2012 eBay Inc., Evan Chiu, Woody Zhou, Jack Shen, Gyanit Singh, Neel Sundaresan
 *
 */

import java.util.HashMap;

import java.util.Map;

public class Main {
    private static final Map<String, Class<?>> _CLASS_MAPPING = new HashMap<String, Class<?>>();

    /**
     * Get the {@link Class} reference by the given
     * <code>fullClassName</code>.
     */
    public static Class<?> getClass(String fullClassName) {
        Class<?> clazz = null;
        synchronized (_CLASS_MAPPING) {
            if ((clazz = _CLASS_MAPPING.get(fullClassName)) == null) {
                try {
                    clazz = Class.forName(fullClassName);
                    _CLASS_MAPPING.put(fullClassName, clazz);
                } catch (ClassNotFoundException e) {
                    throw new RuntimeException(e);
                }
            }
        }
        return clazz;
    }
}

Related

  1. fromString(String string, Class arrayClass)
  2. getClass(Class clazz)
  3. getClass(String className)
  4. getClass(String className)
  5. getClass(String className)
  6. getClass(String name)
  7. getClass(String name)
  8. getClass(String upnpDataType)
  9. getClassDescriptor(Class type)