^1640740804513
@
sname
ClassDoc
slabel
ClassDoc
sdescriptors
xworker.web.ControlSet
sth_createIndex
false
  @/@clsDoc
  sname
  clsDoc
  sdescriptors
  xworker.web.ControlSet/@SimpleControl
  sth_createIndex
  false
  sid
  clsDoc
    @/@clsDoc/@actions
    sname
    actions
    sdescriptors
    xworker.web.controls.SimpleControl/@actions
    sth_createIndex
    false
    sid
    actions
      @/@clsDoc/@actions/@doAction
      sname
      doAction
      sisSynchronized
      false
      sthrowException
      true
      suseOtherAction
      false
      svarScope
      Global
      sdisableGlobalContext
      false
      Scode
#$@text#$@
import java.lang.reflect.Modifier;

import xworker.swt.ui.editor.UtilThingDoc;

//类
def className = requestBean.className;
def cls = Class.forName(className);
def data = ["name": className, "path":className];

//字段
def fields = [];
for(field in cls.getDeclaredFields()){
    if(field.isSynthetic()){
        continue;
    }
    if(!Modifier.isPublic(field.getModifiers())){
        continue;
    }
    
    def f = [:];
    f.name = field.name;
    f.modifier = Modifier.toString(field.getModifiers());
    f.type = field.getType().simpleName;
    if(!field.getType().isPrimitive()){
        f.className  = field.getType().name;
    }
    fields.add(f);
}
data.fields = fields;
data.fields.sort(){ a,b->   
            return a.name.compareTo(b.name);       
        }   

//构造函数
def constructors = [];
for(cons in cls.getDeclaredConstructors()){
    if(!Modifier.isPublic(cons.getModifiers())){
        continue;
    }
    def m = [:];
    m.name = cls.simpleName;
    m.params = [];
    int index = 1;
    for(ptype in cons.getParameterTypes()){
        def arg = ["type":ptype.simpleName, "name":"arg" + index];
        if(!ptype.isPrimitive()){
            arg.className = ptype.name;
        }
        m.params.add(arg);
        index++;
    }
    constructors.add(m);
}
data.constructors = constructors;
data.constructors.sort(){ a,b->   
            return a.name.compareTo(b.name);       
        }   


//方法
def methods = [];
for(method in cls.getDeclaredMethods()){
    if(!Modifier.isPublic(method.getModifiers())){
        continue;
    }
    def m = [:];
    m.name = method.name;
    m.genericString = method.toGenericString();
    m.string = method.toString();
    m.modifier = Modifier.toString(method.getModifiers());
    m.returnType = method.getReturnType().simpleName;
    if(!method.getReturnType().isPrimitive()){
        m.returnTypeCls = method.getReturnType().name;
    }
    m.params = [];
    int index = 1;
    for(ptype in method.getParameterTypes()){
        def arg = ["type":ptype.simpleName, "name":"arg" + index];
        if(!ptype.isPrimitive()){
            arg.className = ptype.name;
        }
        m.params.add(arg);
        index++;
    }
    methods.add(m);
}
data.methods = methods;
data.methods.sort(){ a,b->   
            return a.name.compareTo(b.name);       
        }   


actionContext.getScope(0).put("cls", data);
utilDoc = UtilThingDoc.getInstance();

return "success";
#$@text#$@
      sdescriptors
      xworker.lang.actions.Actions/@GroovyAction
      sth_createIndex
      false
      sid
      doAction
    @/@clsDoc/@success
    sname
    success
    stype
    freemarker
    scontentType
    text/html;charset=UTF-8
    svalue
    /xworker/ide/worldExplorer/swt/http/classDoc.ftl
    sdescriptors
    xworker.web.controls.SimpleControl/@result
    sth_createIndex
    false
    sid
    success
