com.opensymphony.xwork2.util.ValueStack.findValue()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(114)

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

ValueStack.findValue介绍

[英]Find a value by evaluating the given expression against the stack in the default search order.
[中]通过按默认搜索顺序对堆栈计算给定表达式来查找值。

代码示例

代码示例来源:origin: httl/httl

public Object get(Object key) {
  if ("request".equals(key) || "response".equals(key)) {
    return null;
  }
  return valueStack.findValue((String) key);
}

代码示例来源:origin: org.entando.entando/entando-core-engine

private void getActualValue(String value) {
  if (value.startsWith("%{") && value.endsWith("}")) {
    value = value.substring(2, value.length() - 1);
    this.value = (String) getStack().findValue(value, String.class);
  }
}

代码示例来源:origin: com.googlecode.struts2-conversation/struts2-junit4-plugin

/**
 * gets an object from the stack after an action is executed
 */
protected Object findValueAfterExecute(String key) {
  return ServletActionContext.getValueStack(request).findValue(key);
}

代码示例来源:origin: org.apache.struts.xwork/xwork-core

public Object evaluate(String parsedValue) {
    Object o = stack.findValue(parsedValue, asType);
    if (evaluator != null && o != null) {
      o = evaluator.evaluate(o.toString());
    }
    return o;
  }
};

代码示例来源:origin: org.apache.struts/struts2-junit-plugin

/**
 * gets an object from the stack after an action is executed
 */
protected Object findValueAfterExecute(String key) {
  return ServletActionContext.getValueStack(request).findValue(key);
}

代码示例来源:origin: org.apache.struts/struts2-junit-plugin

/**
 * gets an object from the stack after an action is executed
 */
protected Object findValueAfterExecute(String key) {
  return ServletActionContext.getValueStack(request).findValue(key);
}

代码示例来源:origin: org.entando.entando/entando-admin-console

private String getActualValue(String value) {
  if (value.startsWith("%{") && value.endsWith("}")) {
    value = value.substring(2, value.length() - 1);
    return (String) this.getStack().findValue(value, String.class);
  }
  return null;
}

代码示例来源:origin: org.entando.entando/entando-core-engine

private String getActualValue(String value) {
  if (value.startsWith("%{") && value.endsWith("}")) {
    value = value.substring(2, value.length() - 1);
    return (String) this.getStack().findValue(value, String.class);
  }
  return null;
}

代码示例来源:origin: entando/entando-core

private String getActualValue(String value) {
  if (value.startsWith("%{") && value.endsWith("}")) {
    value = value.substring(2, value.length() - 1);
    return (String) this.getStack().findValue(value, String.class);
  }
  return null;
}

代码示例来源:origin: org.entando.entando/entando-admin-console

private String getActualValue(String value) {
  if (value.startsWith("%{") && value.endsWith("}")) {
    value = value.substring(2, value.length() - 1);
    return (String) getStack().findValue(value, String.class);
  }
  return value;
}

代码示例来源:origin: org.entando.entando/entando-core-engine

private String getActualValue(String value) {
  if (value.startsWith("%{") && value.endsWith("}")) {
    value = value.substring(2, value.length() - 1);
    return (String) getStack().findValue(value, String.class);
  }
  return value;
}

代码示例来源:origin: org.beangle.struts2/beangle-struts2-view

protected Object getValue(Object obj, String property) {
 stack.push(obj);
 try {
  Object value = stack.findValue(property);
  if (value instanceof Number) { return MessageFormat.format(NumberFormat, value); }
  return value;
 } finally {
  stack.pop();
 }
}

代码示例来源:origin: org.apache.struts/struts2-javatemplates-plugin

protected Object findValue(String expr) {
  if (expr == null) {
    return null;
  }
  ValueStack stack = context.getStack();
  return stack.findValue(ComponentUtils.stripExpressionIfAltSyntax(stack, expr));
}

代码示例来源:origin: org.apache.struts/struts2-json-plugin

protected Object findRootObject(ActionInvocation invocation) {
  Object rootObject;
  if (this.root != null) {
    ValueStack stack = invocation.getStack();
    rootObject = stack.findValue(root);
  } else {
    rootObject = invocation.getStack().peek(); // model overrides action
  }
  return rootObject;
}

代码示例来源:origin: com.googlecode.struts2-conversation/struts2-conversation-scope-plugin

@Override
protected void populateParams() {
  super.populateParams();
  @SuppressWarnings("unchecked")
  Map<String, String> convoIdMap = (Map<String, String>) this.component
      .getStack().findValue(
          StrutsScopeConstants.CONVERSATION_ID_MAP_STACK_KEY);
  this.component.addAllParameters(convoIdMap);
}

代码示例来源:origin: org.apache.struts/struts2-javatemplates-plugin

private Object findValue(String expr, Class toType) {
    ValueStack stack = context.getStack();

    if (altSyntax && toType == String.class) {
      return TextParseUtil.translateVariables('%', expr, stack);
    } else {
      return stack.findValue(ComponentUtils.stripExpressionIfAltSyntax(stack, expr), toType);
    }
  }
}

代码示例来源:origin: org.apache.struts.xwork/xwork-core

public void testCreateNullObjectsIsFalseByDefault() {
  ValueStack vs = ActionContext.getContext().getValueStack();
  vs.push(new MapHolder(Collections.emptyMap()));
  assertNull(vs.findValue("map[key]"));
}

代码示例来源:origin: org.apache.struts.xwork/xwork-core

public void testMapContentsAreReturned() {
  ValueStack vs = ActionContext.getContext().getValueStack();
  vs.push(new MapHolder(Collections.singletonMap("key", "value")));
  assertEquals("value", vs.findValue("map['key']"));
}

代码示例来源:origin: org.apache.struts.xwork/xwork-core

public void testNullIsNotReturnedWhenCreateNullObjectsIsSpecified() {
  ValueStack vs = ActionContext.getContext().getValueStack();
  vs.push(new MapHolder(Collections.emptyMap()));
  ReflectionContextState.setCreatingNullObjects(vs.getContext(), true);
  Object value = vs.findValue("map['key']");
  assertNotNull(value);
  assertSame(Object.class, value.getClass());
}

代码示例来源:origin: org.apache.struts.xwork/xwork-core

public void testNullIsReturnedWhenCreateNullObjectsIsSpecifiedAsFalse() {
  ValueStack vs = ActionContext.getContext().getValueStack();
  vs.push(new MapHolder(Collections.emptyMap()));
  ReflectionContextState.setCreatingNullObjects(vs.getContext(), false);
  assertNull(vs.findValue("map['key']"));
}

相关文章