org.springframework.webflow.engine.Flow.addVariable()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(199)

本文整理了Java中org.springframework.webflow.engine.Flow.addVariable()方法的一些代码示例,展示了Flow.addVariable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flow.addVariable()方法的具体详情如下:
包路径:org.springframework.webflow.engine.Flow
类名称:Flow
方法名:addVariable

Flow.addVariable介绍

[英]Adds a flow variable.
[中]添加一个流变量。

代码示例

代码示例来源:origin: org.springframework.webflow/spring-webflow

/**
 * Adds flow variables.
 * @param variables the variables
 */
public void addVariables(FlowVariable... variables) {
  if (variables == null) {
    return;
  }
  for (FlowVariable variable : variables) {
    addVariable(variable);
  }
}

代码示例来源:origin: org.springframework.webflow/spring-webflow

/**
 * Builds any variables initialized by the flow when it starts.
 * @throws FlowBuilderException an exception occurred building the flow
 */
public void buildVariables() throws FlowBuilderException {
  if (flowModel.getVars() != null) {
    for (VarModel varModel : flowModel.getVars()) {
      getFlow().addVariable(parseFlowVariable(varModel));
    }
  }
}

代码示例来源:origin: spring-projects/spring-webflow

/**
 * Adds flow variables.
 * @param variables the variables
 */
public void addVariables(FlowVariable... variables) {
  if (variables == null) {
    return;
  }
  for (FlowVariable variable : variables) {
    addVariable(variable);
  }
}

代码示例来源:origin: org.springframework/spring-webflow

/**
 * Adds flow variables.
 * @param variables the variables
 */
public void addVariables(FlowVariable[] variables) {
  if (variables == null) {
    return;
  }
  for (int i = 0; i < variables.length; i++) {
    addVariable(variables[i]);
  }
}

代码示例来源:origin: org.springframework.webflow/org.springframework.webflow

/**
 * Adds flow variables.
 * @param variables the variables
 */
public void addVariables(FlowVariable[] variables) {
  if (variables == null) {
    return;
  }
  for (int i = 0; i < variables.length; i++) {
    addVariable(variables[i]);
  }
}

代码示例来源:origin: org.springframework/spring-webflow

private void parseAndAddFlowVariables(Element flowElement, Flow flow) {
  List varElements = DomUtils.getChildElementsByTagName(flowElement, VAR_ELEMENT);
  for (Iterator it = varElements.iterator(); it.hasNext();) {
    flow.addVariable(parseVariable((Element) it.next()));
  }
}

代码示例来源:origin: org.springframework.webflow/org.springframework.webflow

/**
 * Builds any variables initialized by the flow when it starts.
 * @throws FlowBuilderException an exception occurred building the flow
 */
public void buildVariables() throws FlowBuilderException {
  if (flowModel.getVars() != null) {
    for (Iterator it = flowModel.getVars().iterator(); it.hasNext();) {
      getFlow().addVariable(parseFlowVariable((VarModel) it.next()));
    }
  }
}

代码示例来源:origin: org.apereo.cas/cas-server-core-webflow-api

/**
 * Create flow variable flow variable.
 *
 * @param flow the flow
 * @param id   the id
 * @param type the type
 * @return the flow variable
 */
public FlowVariable createFlowVariable(final Flow flow, final String id, final Class type) {
  val opt = Arrays.stream(flow.getVariables()).filter(v -> v.getName().equalsIgnoreCase(id)).findFirst();
  if (opt.isPresent()) {
    return opt.get();
  }
  val flowVar = new FlowVariable(id, new BeanFactoryVariableValueFactory(type, applicationContext.getAutowireCapableBeanFactory()));
  flow.addVariable(flowVar);
  return flowVar;
}

代码示例来源:origin: spring-projects/spring-webflow

/**
 * Builds any variables initialized by the flow when it starts.
 * @throws FlowBuilderException an exception occurred building the flow
 */
public void buildVariables() throws FlowBuilderException {
  if (flowModel.getVars() != null) {
    for (VarModel varModel : flowModel.getVars()) {
      getFlow().addVariable(parseFlowVariable(varModel));
    }
  }
}

代码示例来源:origin: spring-projects/spring-webflow

public void testStartWithVariables() {
  MockRequestControlContext context = new MockRequestControlContext(flow);
  flow.addVariable(new FlowVariable("var1", new VariableValueFactory() {
    public Object createInitialValue(RequestContext context) {
      return new ArrayList<>();
    }
    public void restoreReferences(Object value, RequestContext context) {
    }
  }));
  flow.start(context, new LocalAttributeMap<>());
  context.getFlowScope().getRequired("var1", ArrayList.class);
}

相关文章