| Method from com.opensymphony.xwork2.ognl.OgnlValueStack Detail: |
public void clearContextValues() {
//this is an OGNL ValueStack so the context will be an OgnlContext
//it would be better to make context of type OgnlContext
((OgnlContext)context).getValues().clear();
}
|
public String findString(String expr) {
return (String) findValue(expr, String.class);
}
|
public String findString(String expr,
boolean throwExceptionOnFailure) {
return (String) findValue(expr, String.class, throwExceptionOnFailure);
}
|
public Object findValue(String expr) {
return findValue(expr, false);
}
|
public Object findValue(String expr,
boolean throwExceptionOnFailure) {
try {
if (expr == null) {
return null;
}
if ((overrides != null) && overrides.containsKey(expr)) {
expr = (String) overrides.get(expr);
}
if (defaultType != null) {
return findValue(expr, defaultType);
}
Object value = ognlUtil.getValue(expr, context, root);
if (value != null) {
return value;
} else {
checkForInvalidProperties(expr, throwExceptionOnFailure, throwExceptionOnFailure);
return findInContext(expr);
}
} catch (OgnlException e) {
checkForInvalidProperties(expr, throwExceptionOnFailure, throwExceptionOnFailure);
return findInContext(expr);
} catch (Exception e) {
logLookupFailure(expr, e);
if (throwExceptionOnFailure)
throw new XWorkException(e);
return findInContext(expr);
} finally {
ReflectionContextState.clear(context);
}
}
|
public Object findValue(String expr,
Class asType) {
return findValue(expr, asType, false);
}
|
public Object findValue(String expr,
Class asType,
boolean throwExceptionOnFailure) {
try {
if (expr == null) {
return null;
}
if ((overrides != null) && overrides.containsKey(expr)) {
expr = (String) overrides.get(expr);
}
Object value = ognlUtil.getValue(expr, context, root, asType);
if (value != null) {
return value;
} else {
checkForInvalidProperties(expr, throwExceptionOnFailure, throwExceptionOnFailure);
return findInContext(expr);
}
} catch (OgnlException e) {
checkForInvalidProperties(expr, throwExceptionOnFailure, throwExceptionOnFailure);
return findInContext(expr);
} catch (Exception e) {
logLookupFailure(expr, e);
if (throwExceptionOnFailure)
throw new XWorkException(e);
return findInContext(expr);
} finally {
ReflectionContextState.clear(context);
}
}
|
public Map<String, Object> getContext() {
return context;
}
|
public Map<Object, Object> getExprOverrides() {
return this.overrides;
}
|
public CompoundRoot getRoot() {
return root;
}
|
public static void link(Map<String, Object> context,
Class clazz,
String name) {
context.put("__link", new Object[]{clazz, name});
}
|
public Object peek() {
return root.peek();
}
|
public Object pop() {
return root.pop();
}
|
public void push(Object o) {
root.push(o);
}
|
public void set(String key,
Object o) {
//set basically is backed by a Map
//pushed on the stack with a key
//being put on the map and the
//Object being the value
Map setMap = null;
//check if this is a Map
//put on the stack for setting
//if so just use the old map (reduces waste)
Object topObj = peek();
if (topObj instanceof Map
&& ((Map) topObj).get(MAP_IDENTIFIER_KEY) != null) {
setMap = (Map) topObj;
} else {
setMap = new HashMap();
//the map identifier key ensures
//that this map was put there
//for set purposes and not by a user
//whose data we don't want to touch
setMap.put(MAP_IDENTIFIER_KEY, "");
push(setMap);
}
setMap.put(key, o);
}
|
public void setAcceptProperties(Set<Pattern> acceptedProperties) {
securityMemberAccess.setAcceptProperties(acceptedProperties);
}
|
public void setDefaultType(Class defaultType) {
this.defaultType = defaultType;
}
|
public void setDevMode(String mode) {
devMode = "true".equalsIgnoreCase(mode);
}
|
public void setExcludeProperties(Set<Pattern> excludeProperties) {
securityMemberAccess.setExcludeProperties(excludeProperties);
}
|
public void setExprOverrides(Map<Object, Object> overrides) {
if (this.overrides == null) {
this.overrides = overrides;
} else {
this.overrides.putAll(overrides);
}
}
|
public void setLogMissingProperties(String logMissingProperties) {
this.logMissingProperties = "true".equalsIgnoreCase(logMissingProperties);
}
|
public void setOgnlUtil(OgnlUtil ognlUtil) {
this.ognlUtil = ognlUtil;
}
|
protected void setRoot(XWorkConverter xworkConverter,
CompoundRootAccessor accessor,
CompoundRoot compoundRoot,
boolean allowStaticMethodAccess) {
this.root = compoundRoot;
this.securityMemberAccess = new SecurityMemberAccess(allowStaticMethodAccess);
this.context = Ognl.createDefaultContext(this.root, accessor, new OgnlTypeConverterWrapper(xworkConverter),
securityMemberAccess);
context.put(VALUE_STACK, this);
Ognl.setClassResolver(context, accessor);
((OgnlContext) context).setTraceEvaluations(false);
((OgnlContext) context).setKeepLastEvaluation(false);
}
|
public void setValue(String expr,
Object value) {
setValue(expr, value, devMode);
}
|
public void setValue(String expr,
Object value,
boolean throwExceptionOnFailure) {
Map< String, Object > context = getContext();
try {
context.put(XWorkConverter.CONVERSION_PROPERTY_FULLNAME, expr);
context.put(REPORT_ERRORS_ON_NO_PROP, (throwExceptionOnFailure) ? Boolean.TRUE : Boolean.FALSE);
ognlUtil.setValue(expr, context, root, value);
} catch (OgnlException e) {
String msg = "Error setting expression '" + expr + "' with value '" + value + "'";
if (LOG.isWarnEnabled()) {
LOG.warn(msg, e);
}
if (throwExceptionOnFailure) {
throw new XWorkException(msg, e);
}
} catch (RuntimeException re) { //XW-281
if (throwExceptionOnFailure) {
StringBuilder msg = new StringBuilder();
msg.append("Error setting expression '");
msg.append(expr);
msg.append("' with value ");
if (value instanceof Object[]) {
Object[] valueArray = (Object[]) value;
msg.append("[");
for (int index = 0; index < valueArray.length; index++) {
msg.append("'");
msg.append(valueArray[index]);
msg.append("'");
if (index < (valueArray.length + 1))
msg.append(", ");
}
msg.append("]");
} else {
msg.append("'");
msg.append(value);
msg.append("'");
}
throw new XWorkException(msg.toString(), re);
} else {
if (LOG.isWarnEnabled()) {
LOG.warn("Error setting value", re);
}
}
} finally {
ReflectionContextState.clear(context);
context.remove(XWorkConverter.CONVERSION_PROPERTY_FULLNAME);
context.remove(REPORT_ERRORS_ON_NO_PROP);
}
}
|
public int size() {
return root.size();
}
|