Return format instance usable to requested class.

@param className the name of class to retrieve formatter for.
@return format for requested class.
182076
public static Format getFormat(String className) {
		assert className != null;
		if (className.isEmpty()) {
			return null;
		}

		ThreadLocal<Format> tlsFormatter = classFormatters.get(className);
		if (tlsFormatter == null) {
			try {
				// append formatter class name to cache only if exists and is of right type
				Classes.forName(className);
				tlsFormatter = new ThreadLocal<Format>();
				classFormatters.put(className, tlsFormatter);
			} catch (NoSuchBeingException e) {
				log.error("Formatter class |%s| not found.", className);
				return null;
			} catch (ClassCastException e) {
				log.error("Invalid formatter class |%s|. It should inherit from |%s|.", className, Format.class);
				return null;
			}
		}

		Format formatter = tlsFormatter.get();
		if (formatter == null) {
			formatter = createFormatter(className);
			if (formatter == null) {
				// formatter can be invalid only if miss proper constructor and this is for sure a flaw in logic
				throw new BugError("Invalid formatter class |%s|. Proper constructor not found.", className);
			}
			tlsFormatter.set(formatter);
		}
		return formatter;
	}
184066
@SuppressWarnings("unchecked")
  public Class<? extends OutputFormat<?,?>> getOutputFormatClass() 
     throws ClassNotFoundException {
    return (Class<? extends OutputFormat<?,?>>) 
      conf.getClass(OUTPUT_FORMAT_CLASS_ATTR, TextOutputFormat.class);
  }
950996
public static Class<?> lenientClassForName(String className) throws ClassNotFoundException {
    try {
      // TODO: consider whether any control over class loader is really needed here
      // (forName(className, true, Thread.currentThread().getContextClassLoader())?)
      return Class.forName(className);
    } catch (ClassNotFoundException ignored) {
      // try replacing the last dot with a $, in case that helps
      // example: tutorial.Tutorial.Benchmark1 becomes tutorial.Tutorial$Benchmark1
      // amusingly, the $ character means three different things in this one line alone
      String newName = className.replaceFirst("\\.([^.]+)$", "\\$$1");
      return Class.forName(newName);
    }
  }
768821
Formatter getFormatterProperty(String name, Formatter defaultValue) {
        String val = getProperty(name);
        try {
            if (val != null) {
                return (Formatter) getClassInstance(val).newInstance();
            }
        } catch (Exception ex) {
            // We got one of a variety of exceptions in creating the
            // class or creating an instance.
            // Drop through.
        }
        // We got an exception.  Return the defaultValue.
        return defaultValue;
    }
649127
public static Class<?> classForName(String className, ClassLoader classLoader)
    {
        try
        {
            Class<?> c = null;
            try
            {
                c = Class.forName(className, true, ReflectUtils.class.getClassLoader());
            }
            catch (ClassNotFoundException e)
            {
                try
                {
                    c = Class.forName(className);
                }
                catch (ClassNotFoundException e1)
                {
                    if (classLoader == null)
                    {
                        throw e1;
                    }
                    else
                    {
                        c = classLoader.loadClass(className);
                    }
                }
            }
            return c;
        }
        catch (ClassNotFoundException e)
        {
            throw new KunderaException(e);
        }
    }
205613
static Class getClassForName(String className)
      throws ClassNotFoundException
  {
    // Hack for backwards compatibility with XalanJ1 stylesheets
    if(className.equals("org.apache.xalan.xslt.extensions.Redirect")) {
      className = "org.apache.xalan.lib.Redirect";
    }

    return ObjectFactory.findProviderClass(
        className, ObjectFactory.findClassLoader(), true);
  }
58836
public @Nonnull
    ClassDescriptor getClassDescriptor(@SlashedClassName String className) {
        assert className.indexOf('.') == -1;
        ClassDescriptor classDescriptor = classDescriptorMap.get(className);
        if (classDescriptor == null) {
            if (MODULE_INFO.getClassName().equals(className)) {
                // don't allow module info to be added to the map,
                // which could be used to check referenced classes
                return MODULE_INFO;
            }
            classDescriptor = new ClassDescriptor(className);
            classDescriptorMap.put(className, classDescriptor);
        }
        return classDescriptor;
    }
1125377
public Class<?> getClassByName(String name) throws ClassNotFoundException {
		Class<?> ret = getClassByNameOrNull(name);
		if (ret == null) {
			throw new ClassNotFoundException("Class " + name + " not found");
		}
		return ret;
	}
1226020
public static ImageWriter getWriter(String formatName) {
		ImageWriter writer = null;
		Iterator<ImageWriter> iter = ImageIO.getImageWritersByFormatName(formatName);
		if (iter.hasNext()) {
			writer = iter.next();
		}
		if (null == writer) {
			// 尝试扩展名获取
			iter = ImageIO.getImageWritersBySuffix(formatName);
			if (iter.hasNext()) {
				writer = iter.next();
			}
		}
		return writer;
	}
838318
protected final ClassFile getClassFile(String className)
	{
		ClassFile cf=null;
		String filePath=null;
		if(className!=null && !className.isEmpty())
		{
			String rootPath=getClassRootDir();
			if(rootPath.endsWith("/")||rootPath.endsWith("\\"))
			{
			}else
			{
				rootPath=rootPath+File.separator;
			}
			filePath=rootPath+className.replace('.', File.separatorChar)+".class";
		}
		File file=new File(filePath);
		if(file.exists() && file.isFile())
		{
			cf=new ClassFile(className, file.getPath());
			cf.setLastModifyTime(file.lastModified());
		}
		return cf;
	}
1205931
protected String formatClass(final JavaClassSource javaClass) {
        final Properties prefs = new Properties();
        try {
            prefs.load(BeanGenerator.class.getResourceAsStream(FORMATTER_PROPERTIES_FILE));
        } catch (final IOException e) {
            e.printStackTrace();
        }
        final String formattedSource = prefs != null ? Formatter.format(prefs, javaClass) : Formatter.format(javaClass);

        // System.out.println(formattedSource);

        return formattedSource;
    }
1196908
public ClassRecord getClassRecord (String className)
    {
        Iterator<ClassRecord> iter = _classes.values().iterator();
        while (iter.hasNext()) {
            ClassRecord crec = iter.next();
            if (crec.name.equals(className)) {
                return crec;
            }
        }
        log.warning("No such color class", "class", className, new Exception());
        return null;
    }
692813
public static String getClassNameWithExtension(final String className)
	{
		return new StringBuilder().append(className).append(Kind.SOURCE.extension).toString();
	}
545431
public static Formatter getFormatter()
    {
        Formatter formatter = out.get();
        if (formatter == null)
        {
            formatter = new Formatter(new StringBuilder());
            out.set(formatter);
        }
        else
        {
            StringBuilder sb = (StringBuilder) formatter.out();
            sb.setLength(0);
        }
        return formatter;
    }
812827
public static Object createInstance(String className)
    {
        //get type
        Class<?> type=ReflectionHelper.getType(className);

        //create instance
        Object instance=ReflectionHelper.createInstance(type);
        
        return instance;
    }
1087255
public static String getJustClassName(String classname)
   {
      int index = classname.lastIndexOf('.');
      if (index < 0)
         index = 0;
      else index = index + 1;
      return classname.substring(index);
   }
418014
public ClassInfo getClassInfo(final String className) {
        for(ClassInfo item : classInfos) {
            if(item.getClassName().equals(className)) {
                return item;
            }
        }
        return null;
    }