public boolean getBoolean(int i, boolean defaultValue) { Pro value = pros[i]; if (value == null) return defaultValue; boolean value_ = value.getBoolean(defaultValue); return value_; }
public ProList getList(int i) { Pro value = pros[i]; if (value == null) return null; return value.getList(); }
public String getString(int i) { Pro value = pros[i]; if (value == null) return null; return value.getString(); }
public boolean getBoolean(int i) { Pro value = pros[i]; if (value == null) return false; // boolean value_ = Boolean.parseBoolean(value.toString()); return value.getBoolean(); }
public int getInt(int i, int defaultValue) { Pro value = pros[i]; if (value == null) return defaultValue; // int value_ = Integer.parseInt(value.toString()); return value.getInt(); }
/** * 获取方法的惟一标识 * @return */ public String getUUID() { try { if(uuid != null) return uuid; if(this.isPattern()) { return this.uuid = this.pattern; } StringBuffer uuid_ = new StringBuffer(); uuid_.append(this.methodName); if(this.params != null) { for(int i = 0; i < params.size(); i ++) { Pro param = (Pro)params.get(i); uuid_.append("_").append(param.getClazz()); } } uuid = uuid_.toString(); return uuid; } catch(Exception e) { log.error("",e); return null; } }
public ProSet getSet(int i, ProSet defaultValue) { Pro value = pros[i]; if (value == null) return defaultValue; return value.getSet(defaultValue); }
public String getString(int i, String defaultValue) { Pro value = pros[i]; if (value == null) return defaultValue; return value.getString(defaultValue); }
public Object getObject(int i, Object defaultValue) { Pro value = pros[i]; if (value == null) return defaultValue; return value.getObject(defaultValue); }
public Object getComponentArray(CallContext callcontext) { if (this.getComponentType() == null) return this; if (componentArray == null) { synchronized (lock) { if (componentArray == null) { // if (this.size() > 0) { if (this.componentType.equalsIgnoreCase(Pro.COMPONENT_BEAN)) { Class enumType = this.pros[0].getBeanClass(); // componentArray = new ArrayList(this.size()); componentArray = Array.newInstance(enumType, this .size()); int i = 0; if(pros != null) { Context currentLoopContext = callcontext != null?callcontext.getLoopContext():null; for (Pro v : this.pros) { try{ Array.set(componentArray, i, v.getBean(callcontext)); } finally { if(callcontext != null) callcontext.setLoopContext(currentLoopContext); } i++; } } } else if (this.componentType .equalsIgnoreCase(Pro.COMPONENT_STRING_SHORTNAME) || this.componentType .equalsIgnoreCase(Pro.COMPONENT_STRING)) { // componentArray = new ArrayList(this.size()); componentArray = Array.newInstance(String.class, this.size()); int i = 0; if(pros != null) { for (Pro v : this.pros) { Array.set(componentArray, i, v.getString()); i++; } } } else if (this.componentType.equalsIgnoreCase(Pro.COMPONENT_OBJECT_SHORTNAME) || this.componentType.equalsIgnoreCase(Pro.COMPONENT_OBJECT)) { // componentArray = new ArrayList(this.size()); componentArray = Array.newInstance(Object.class, this .size()); int i = 0; if(pros != null) { Context currentLoopContext = callcontext != null?callcontext.getLoopContext():null; for (Pro v : this.pros) { try{ Array.set(componentArray, i, v.getBean(callcontext)); } finally { if(callcontext != null) callcontext.setLoopContext(currentLoopContext); } i++; } } } else if (this.componentType.equalsIgnoreCase(Pro.COMPONENT_CLASS) ) { // componentArray = new ArrayList(this.size()); componentArray = Array.newInstance(Class.class, this .size()); int i = 0; if(pros != null) { Context currentLoopContext = callcontext != null?callcontext.getLoopContext():null; for (Pro v : this.pros) { try{ Object value = v.getBean(callcontext); Array.set(componentArray, i, ValueObjectUtil.typeCast(value, Class.class)); } finally { if(callcontext != null) callcontext.setLoopContext(currentLoopContext); } i++; } } } else { try { componentArray = Array.newInstance(ValueObjectUtil.getClass(componentType), this .size()); int i = 0; if(pros != null) { Context currentLoopContext = callcontext != null?callcontext.getLoopContext():null; for (Pro v : this.pros) { try{ Array.set(componentArray, i, v.getBean(callcontext)); } finally { if(callcontext != null) callcontext.setLoopContext(currentLoopContext); } i++; } } } catch (NegativeArraySizeException e) { log.error(e.getMessage(),e); componentArray = this; } catch (ClassNotFoundException e) { log.error(e.getMessage(),e); componentArray = this; } catch (Exception e) { log.error(e.getMessage(),e); componentArray = this; } } } // else { // componentArray = this; // } } } } return componentArray; }
public void addParam(Pro param) { this.params.add(param); this.paramIndexs.put(param.getClazz(), param); }