package com.ql.util.express.instruction.opdata; import java.util.List; import org.apache.commons.logging.Log; import com.ql.util.express.InstructionSet; import com.ql.util.express.InstructionSetContext; import com.ql.util.express.InstructionSetRunner; import com.ql.util.express.OperateData; import com.ql.util.express.instruction.OperateDataCacheManager; /** * 虚拟Class的内存对象 * @author xuannan * */ public class OperateDataVirClass extends OperateDataAttr{ /** * 虚拟Class的数据上下文 */ InstructionSetContext context; /** * 虚拟类的指令集合 */ InstructionSet virClassInstructionSet; boolean isTrace; Log log; public OperateDataVirClass(String name){ super(name,null); } public void initialInstance(InstructionSetContext parent,OperateData[] parameters, List errorList,boolean aIsTrace,Log aLog) throws Exception { this.isTrace = aIsTrace; this.log = aLog; this.context = OperateDataCacheManager.fetchInstructionSetContext(false, parent.getExpressRunner(),parent,parent.getExpressLoader(),parent.isSupportDynamicFieldName()); Object functionSet = parent.getSymbol(this.name); if (functionSet == null || functionSet instanceof InstructionSet == false) { throw new Exception("没有找到自定义对象\"" + this.name + "\""); } this.virClassInstructionSet = (InstructionSet)functionSet; OperateDataLocalVar[] vars = virClassInstructionSet.getParameters(); for(int i=0;i getValueType(Object name) throws Exception{ Object o = this.context.findAliasOrDefSymbol(name.toString()); if(o instanceof OperateData){ return ((OperateData)o).getType(context); }else{ throw new Exception("不支持的数据类型:" + o.getClass().getName()); } } public Object getObjectInner(InstructionSetContext context) { return this; } public Class getType(InstructionSetContext context) throws Exception { return this.getClass(); } public void setObject(InstructionSetContext parent, Object object) { throw new RuntimeException("不支持的方法"); } public String toString(){ return "VClass[" + this.name+"]"; } }