private Object getArgument(Context context, Parameter param) { String paramName = param.getName(); Object obj = Context2ObjectUtil.getObject(param, context, this .getClass().getClassLoader()); if (obj == null) { if (param.isRequired()) { // 如果输入参数是必须的,则抛出异常 LOGGER.logMessage(LogLevel.ERROR, "参数{paramName}未传递", paramName); throw new ParamIsNullException(paramName); } else { // 如果输出参数非必须,直接返回null return null; } } if (!(obj instanceof String)) { return obj; } return ValueUtil.getValue((String) obj, param.getType()); } }
private Object getArgument(Context context, int i) { Parameter des = inputParameters.get(i); String paramName = des.getName(); // =============20130619修改bengin================ Object obj = Context2ObjectUtil.getObject(des, context); // =============20130619修改end================ if (obj == null) { if (des.isRequired()) { // 如果输入参数是必须的,则抛出异常 logger.logMessage(LogLevel.ERROR, "参数{paramName}未传递", paramName); throw new ParamIsNullException(paramName); } else { // 如果输出参数非必须,直接返回null return null; } } if (!(obj instanceof String)) { return obj; } return ValueUtil.getValue((String) obj, des.getType()); }
private Object getArgument(Context context, int i) { Parameter des = inputParameters.get(i); String paramName = des.getName(); // =============20130619修改bengin================ Object obj = Context2ObjectUtil.getObject(des, context, loader); // =============20130619修改end================ if (obj == null) { if (des.isRequired()) { // 如果输入参数是必须的,则抛出异常 LOGGER.logMessage(LogLevel.ERROR, "参数{paramName}未传递", paramName); throw new ParamIsNullException(paramName); } else { // 如果输出参数非必须,直接返回null return null; } } if (!(obj instanceof String)) { return obj; } return ValueUtil.getValue((String) obj, des.getType()); }
if (!oldContext.exist(inputName)) { return Context2ObjectUtil.getObject(input, oldContext, loader); } else {
public static Context getContext(Event event, ServiceInfo info, ClassLoader loder) { Context c = new ContextImpl(); Context oldContext = event.getServiceRequest().getContext(); if (info.getParameters() == null) { return c; } for (Parameter p : info.getParameters()) { Object value = Context2ObjectUtil.getObject(p, oldContext, loder); if (value != null && !(value instanceof java.io.Serializable)) { throw new ParamNotSerializableException(event .getServiceRequest().getServiceId(), p.getName()); } c.put(p.getName(), value); } return c; }