Java Code Examples for org.springframework.expression.spel.ExpressionState#lookupVariable()
The following examples show how to use
org.springframework.expression.spel.ExpressionState#lookupVariable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FunctionReference.java From spring-analysis-note with MIT License | 6 votes |
@Override public TypedValue getValueInternal(ExpressionState state) throws EvaluationException { TypedValue value = state.lookupVariable(this.name); if (value == TypedValue.NULL) { throw new SpelEvaluationException(getStartPosition(), SpelMessage.FUNCTION_NOT_DEFINED, this.name); } if (!(value.getValue() instanceof Method)) { // Possibly a static Java method registered as a function throw new SpelEvaluationException( SpelMessage.FUNCTION_REFERENCE_CANNOT_BE_INVOKED, this.name, value.getClass()); } try { return executeFunctionJLRMethod(state, (Method) value.getValue()); } catch (SpelEvaluationException ex) { ex.setPosition(getStartPosition()); throw ex; } }
Example 2
Source File: FunctionReference.java From java-technology-stack with MIT License | 6 votes |
@Override public TypedValue getValueInternal(ExpressionState state) throws EvaluationException { TypedValue value = state.lookupVariable(this.name); if (value == TypedValue.NULL) { throw new SpelEvaluationException(getStartPosition(), SpelMessage.FUNCTION_NOT_DEFINED, this.name); } if (!(value.getValue() instanceof Method)) { // Possibly a static Java method registered as a function throw new SpelEvaluationException( SpelMessage.FUNCTION_REFERENCE_CANNOT_BE_INVOKED, this.name, value.getClass()); } try { return executeFunctionJLRMethod(state, (Method) value.getValue()); } catch (SpelEvaluationException ex) { ex.setPosition(getStartPosition()); throw ex; } }
Example 3
Source File: FunctionReference.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public TypedValue getValueInternal(ExpressionState state) throws EvaluationException { TypedValue value = state.lookupVariable(this.name); if (value == null) { throw new SpelEvaluationException(getStartPosition(), SpelMessage.FUNCTION_NOT_DEFINED, this.name); } // Two possibilities: a lambda function or a Java static method registered as a function if (!(value.getValue() instanceof Method)) { throw new SpelEvaluationException( SpelMessage.FUNCTION_REFERENCE_CANNOT_BE_INVOKED, this.name, value.getClass()); } try { return executeFunctionJLRMethod(state, (Method) value.getValue()); } catch (SpelEvaluationException ex) { ex.setPosition(getStartPosition()); throw ex; } }
Example 4
Source File: FunctionReference.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Override public TypedValue getValueInternal(ExpressionState state) throws EvaluationException { TypedValue value = state.lookupVariable(this.name); if (value == null) { throw new SpelEvaluationException(getStartPosition(), SpelMessage.FUNCTION_NOT_DEFINED, this.name); } // Two possibilities: a lambda function or a Java static method registered as a function if (!(value.getValue() instanceof Method)) { throw new SpelEvaluationException( SpelMessage.FUNCTION_REFERENCE_CANNOT_BE_INVOKED, this.name, value.getClass()); } try { return executeFunctionJLRMethod(state, (Method) value.getValue()); } catch (SpelEvaluationException ex) { ex.setPosition(getStartPosition()); throw ex; } }
Example 5
Source File: VariableReference.java From spring-analysis-note with MIT License | 5 votes |
@Override public ValueRef getValueRef(ExpressionState state) throws SpelEvaluationException { if (this.name.equals(THIS)) { return new ValueRef.TypedValueHolderValueRef(state.getActiveContextObject(),this); } if (this.name.equals(ROOT)) { return new ValueRef.TypedValueHolderValueRef(state.getRootContextObject(),this); } TypedValue result = state.lookupVariable(this.name); // a null value will mean either the value was null or the variable was not found return new VariableRef(this.name,result,state.getEvaluationContext()); }
Example 6
Source File: VariableReference.java From java-technology-stack with MIT License | 5 votes |
@Override public ValueRef getValueRef(ExpressionState state) throws SpelEvaluationException { if (this.name.equals(THIS)) { return new ValueRef.TypedValueHolderValueRef(state.getActiveContextObject(),this); } if (this.name.equals(ROOT)) { return new ValueRef.TypedValueHolderValueRef(state.getRootContextObject(),this); } TypedValue result = state.lookupVariable(this.name); // a null value will mean either the value was null or the variable was not found return new VariableRef(this.name,result,state.getEvaluationContext()); }
Example 7
Source File: VariableReference.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public ValueRef getValueRef(ExpressionState state) throws SpelEvaluationException { if (this.name.equals(THIS)) { return new ValueRef.TypedValueHolderValueRef(state.getActiveContextObject(),this); } if (this.name.equals(ROOT)) { return new ValueRef.TypedValueHolderValueRef(state.getRootContextObject(),this); } TypedValue result = state.lookupVariable(this.name); // a null value will mean either the value was null or the variable was not found return new VariableRef(this.name,result,state.getEvaluationContext()); }
Example 8
Source File: VariableReference.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public ValueRef getValueRef(ExpressionState state) throws SpelEvaluationException { if (this.name.equals(THIS)) { return new ValueRef.TypedValueHolderValueRef(state.getActiveContextObject(),this); } if (this.name.equals(ROOT)) { return new ValueRef.TypedValueHolderValueRef(state.getRootContextObject(),this); } TypedValue result = state.lookupVariable(this.name); // a null value will mean either the value was null or the variable was not found return new VariableRef(this.name,result,state.getEvaluationContext()); }