public String getSourceSetter(final OgnlContext context, final Object target, final Object index) { // This method is called during OGNL's bytecode enhancement optimizations in order to determine better- // performing methods to access the properties of an object. Given IVariablesMap implementations should never // be set any values from OGNL, this exception should never be thrown anyway. throw new UnsupportedCompilationException( "Setting expression for " + context.getCurrentObject() + " with index of " + index + " cannot " + "be computed. IVariablesMap implementations are considered read-only by OGNL."); }
protected Object getValueBody(OgnlContext context, Object source) throws OgnlException { return context.getCurrentObject(); }
protected Object getValueBody(OgnlContext context, Object source) throws OgnlException { return context.getCurrentObject(); }
protected Object getValueBody( OgnlContext context, Object source ) throws OgnlException { return context.getCurrentObject(); }
public String getSourceAccessor(OgnlContext context, Object target, Object index) { String indexStr = index.toString(); // need to convert to primitive for list index access // System.out.println("index class " + index.getClass() + " current type " + context.getCurrentType() + " current object class " + context.getCurrentObject().getClass()); if (context.getCurrentType() != null && !context.getCurrentType().isPrimitive() && Number.class.isAssignableFrom(context.getCurrentType())) { indexStr += "." + OgnlRuntime.getNumericValueGetter(context.getCurrentType()); } else if (context.getCurrentObject() != null && Number.class.isAssignableFrom(context.getCurrentObject().getClass()) && !context.getCurrentType().isPrimitive()) { // means it needs to be cast first as well String toString = String.class.isInstance(index) && context.getCurrentType() != Object.class ? "" : ".toString()"; indexStr = "ognl.OgnlOps#getIntValue(" + indexStr + toString + ")"; } context.setCurrentAccessor(target.getClass()); context.setCurrentType(target.getClass().getComponentType()); return "[" + indexStr + "]"; }
public String coerceToNumeric(String source, OgnlContext context, Node child) Object value = context.getCurrentObject(); && context.getCurrentObject() != null && Number.class.isInstance(context.getCurrentObject())) ret = "((" + ExpressionCompiler.getCastString(context.getCurrentObject().getClass()) + ")" + ret + ")"; ret += "." + OgnlRuntime.getNumericValueGetter(context.getCurrentObject().getClass()); } else if (context.getCurrentType() != null && context.getCurrentType().isPrimitive() && (ASTConst.class.isInstance(child) || NumericExpression.class.isInstance(child)))
public String getSourceAccessor(OgnlContext context, Object target, Object index) { String indexStr = index.toString(); // need to convert to primitive for list index access // System.out.println("index class " + index.getClass() + " current type " + context.getCurrentType() + " current object class " + context.getCurrentObject().getClass()); if (context.getCurrentType() != null && !context.getCurrentType().isPrimitive() && Number.class.isAssignableFrom(context.getCurrentType())) { indexStr += "." + OgnlRuntime.getNumericValueGetter(context.getCurrentType()); } else if (context.getCurrentObject() != null && Number.class.isAssignableFrom(context.getCurrentObject().getClass()) && !context.getCurrentType().isPrimitive()) { // means it needs to be cast first as well String toString = String.class.isInstance(index) && context.getCurrentType() != Object.class ? "" : ".toString()"; indexStr = "ognl.OgnlOps#getIntValue(" + indexStr + toString + ")"; } context.setCurrentAccessor(target.getClass()); context.setCurrentType(target.getClass().getComponentType()); return "[" + indexStr + "]"; }
public String coerceToNumeric(String source, OgnlContext context, Node child) Object value = context.getCurrentObject(); && context.getCurrentObject() != null && Number.class.isInstance(context.getCurrentObject())) ret = "((" + ExpressionCompiler.getCastString(context.getCurrentObject().getClass()) + ")" + ret + ")"; ret += "." + OgnlRuntime.getNumericValueGetter(context.getCurrentObject().getClass()); } else if (context.getCurrentType() != null && context.getCurrentType().isPrimitive() && (ASTConst.class.isInstance(child) || NumericExpression.class.isInstance(child)))
public Object get(Object key) { Object result; if (RESERVED_KEYS.containsKey(key)) { if (key.equals(OgnlContext.THIS_CONTEXT_KEY)) { result = getCurrentObject(); } else { if (key.equals(OgnlContext.ROOT_CONTEXT_KEY)) { result = getRoot(); } else { if (key.equals(OgnlContext.TRACE_EVALUATIONS_CONTEXT_KEY)) { result = getTraceEvaluations() ? Boolean.TRUE : Boolean.FALSE; } else { if (key.equals(OgnlContext.LAST_EVALUATION_CONTEXT_KEY)) { result = getLastEvaluation(); } else { if (key.equals(OgnlContext.KEEP_LAST_EVALUATION_CONTEXT_KEY)) { result = getKeepLastEvaluation() ? Boolean.TRUE : Boolean.FALSE; } else { throw new IllegalArgumentException("unknown reserved key '" + key + "'"); } } } } } } else { result = _values.get(key); } return result; }
result = getCurrentObject(); setCurrentObject(null); } else {
public Object get(Object key) { Object result; if (RESERVED_KEYS.containsKey(key)) { if (key.equals(OgnlContext.THIS_CONTEXT_KEY)) { result = getCurrentObject(); } else { if (key.equals(OgnlContext.ROOT_CONTEXT_KEY)) { result = getRoot(); } else { if (key.equals(OgnlContext.TRACE_EVALUATIONS_CONTEXT_KEY)) { result = getTraceEvaluations() ? Boolean.TRUE : Boolean.FALSE; } else { if (key.equals(OgnlContext.LAST_EVALUATION_CONTEXT_KEY)) { result = getLastEvaluation(); } else { if (key.equals(OgnlContext.KEEP_LAST_EVALUATION_CONTEXT_KEY)) { result = getKeepLastEvaluation() ? Boolean.TRUE : Boolean.FALSE; } else { throw new IllegalArgumentException("unknown reserved key '" + key + "'"); } } } } } } else { result = _values.get(key); } return result; }
} else if (context.getCurrentObject() != null && Number.class.isAssignableFrom(context.getCurrentObject().getClass()) && !context.getCurrentType().isPrimitive())
} else if (context.getCurrentObject() != null && Number.class.isAssignableFrom(context.getCurrentObject().getClass()) && !context.getCurrentType().isPrimitive())
result = getCurrentObject(); setCurrentObject(value); } else {
|| context.getCurrentAccessor().isAssignableFrom(context.getPreviousType()) || (context.getCurrentType() != null && context.getCurrentObject() != null && context.getCurrentType().isAssignableFrom(context.getCurrentObject().getClass()) && context.getCurrentAccessor().isAssignableFrom(context.getPreviousType())) || body == null || body.trim().length() < 1
|| context.getCurrentAccessor().isAssignableFrom(context.getPreviousType()) || (context.getCurrentType() != null && context.getCurrentObject() != null && context.getCurrentType().isAssignableFrom(context.getCurrentObject().getClass()) && context.getCurrentAccessor().isAssignableFrom(context.getPreviousType())) || body == null || body.trim().length() < 1
if (context.getCurrentObject() == null) throw new UnsupportedCompilationException("Current context object is null, can't compile var reference.");
if (context.getCurrentObject() == null) throw new UnsupportedCompilationException("Current context object is null, can't compile var reference.");
if (!OgnlOps.booleanValue(context.getCurrentObject()))
if (!OgnlOps.booleanValue(context.getCurrentObject()))