Package com.google.code.vimsztool.server

Source Code of com.google.code.vimsztool.server.SzjdeDumpClassInfoCommand

package com.google.code.vimsztool.server;

import static com.google.code.vimsztool.server.SzjdeConstants.PARAM_CLASSPATHXML;
import static com.google.code.vimsztool.server.SzjdeConstants.PARAM_DUMP_CLASS;

import com.google.code.vimsztool.compiler.CompilerContext;
import com.google.code.vimsztool.compiler.ReflectAbleClassLoader;
import com.google.code.vimsztool.omni.ClassInfoUtil;

public class SzjdeDumpClassInfoCommand extends SzjdeCommand {

  @SuppressWarnings("unchecked")
  public String execute() {
    String classPathXml = params.get(PARAM_CLASSPATHXML);
    String dumpClass = params.get(PARAM_DUMP_CLASS);
    String[] classNameList = dumpClass.split(",");

    CompilerContext ctx = getCompilerContext(classPathXml);
    ReflectAbleClassLoader classLoader = ctx.getClassLoader();

    Class aClass = null;
    for (String className : classNameList) {
      try {
        aClass = classLoader.loadClass(className);
      } catch (ClassNotFoundException e) {
        try {
          aClass = classLoader.loadClass("java.lang." + className);
        } catch (ClassNotFoundException e2) { }
      }
      if (aClass==null) continue;
      String dumpInfo = ClassInfoUtil.dumpClassInfo(aClass);
      if (dumpInfo.length() > 0) return dumpInfo;
    }

    return "";
  }

}
TOP

Related Classes of com.google.code.vimsztool.server.SzjdeDumpClassInfoCommand

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.