本文整理汇总了Java中org.springframework.expression.spel.SpelEvaluationException.setPosition方法的典型用法代码示例。如果您正苦于以下问题:Java SpelEvaluationException.setPosition方法的具体用法?Java SpelEvaluationException.setPosition怎么用?Java SpelEvaluationException.setPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.expression.spel.SpelEvaluationException
的用法示例。
在下文中一共展示了SpelEvaluationException.setPosition方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValueInternal
import org.springframework.expression.spel.SpelEvaluationException; //导入方法依赖的package包/类
/**
* Returns a boolean based on whether a value is in the range expressed. The first
* operand is any value whilst the second is a list of two values - those two values
* being the bounds allowed for the first operand (inclusive).
* @param state the expression state
* @return true if the left operand is in the range specified, false otherwise
* @throws EvaluationException if there is a problem evaluating the expression
*/
@Override
public BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException {
Object left = getLeftOperand().getValueInternal(state).getValue();
Object right = getRightOperand().getValueInternal(state).getValue();
if (!(right instanceof List) || ((List<?>) right).size() != 2) {
throw new SpelEvaluationException(getRightOperand().getStartPosition(),
SpelMessage.BETWEEN_RIGHT_OPERAND_MUST_BE_TWO_ELEMENT_LIST);
}
List<?> l = (List<?>) right;
Object low = l.get(0);
Object high = l.get(1);
TypeComparator comparator = state.getTypeComparator();
try {
return BooleanTypedValue.forValue((comparator.compare(left, low) >= 0 &&
comparator.compare(left, high) <= 0));
}
catch (SpelEvaluationException ex) {
ex.setPosition(getStartPosition());
throw ex;
}
}
示例2: getValueInternal
import org.springframework.expression.spel.SpelEvaluationException; //导入方法依赖的package包/类
@Override
public TypedValue getValueInternal(ExpressionState state) throws EvaluationException {
TypedValue o = state.lookupVariable(this.name);
if (o == 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 (!(o.getValue() instanceof Method)) {
throw new SpelEvaluationException(SpelMessage.FUNCTION_REFERENCE_CANNOT_BE_INVOKED, this.name, o.getClass());
}
try {
return executeFunctionJLRMethod(state, (Method) o.getValue());
}
catch (SpelEvaluationException se) {
se.setPosition(getStartPosition());
throw se;
}
}
示例3: getValueInternal
import org.springframework.expression.spel.SpelEvaluationException; //导入方法依赖的package包/类
/**
* Returns a boolean based on whether a value is in the range expressed. The first
* operand is any value whilst the second is a list of two values - those two values
* being the bounds allowed for the first operand (inclusive).
* @param state the expression state
* @return true if the left operand is in the range specified, false otherwise
* @throws EvaluationException if there is a problem evaluating the expression
*/
@Override
public BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException {
Object left = getLeftOperand().getValueInternal(state).getValue();
Object right = getRightOperand().getValueInternal(state).getValue();
if (!(right instanceof List) || ((List<?>) right).size() != 2) {
throw new SpelEvaluationException(getRightOperand().getStartPosition(),
SpelMessage.BETWEEN_RIGHT_OPERAND_MUST_BE_TWO_ELEMENT_LIST);
}
List<?> list = (List<?>) right;
Object low = list.get(0);
Object high = list.get(1);
TypeComparator comp = state.getTypeComparator();
try {
return BooleanTypedValue.forValue(comp.compare(left, low) >= 0 && comp.compare(left, high) <= 0);
}
catch (SpelEvaluationException ex) {
ex.setPosition(getStartPosition());
throw ex;
}
}
示例4: getValueInternal
import org.springframework.expression.spel.SpelEvaluationException; //导入方法依赖的package包/类
@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;
}
}
示例5: getValueInternal
import org.springframework.expression.spel.SpelEvaluationException; //导入方法依赖的package包/类
/**
* Returns a boolean based on whether a value is in the range expressed. The first operand is any value whilst the
* second is a list of two values - those two values being the bounds allowed for the first operand (inclusive).
* @param state the expression state
* @return true if the left operand is in the range specified, false otherwise
* @throws EvaluationException if there is a problem evaluating the expression
*/
@Override
public BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException {
Object left = getLeftOperand().getValueInternal(state).getValue();
Object right = getRightOperand().getValueInternal(state).getValue();
if (!(right instanceof List) || ((List<?>) right).size() != 2) {
throw new SpelEvaluationException(getRightOperand().getStartPosition(),
SpelMessage.BETWEEN_RIGHT_OPERAND_MUST_BE_TWO_ELEMENT_LIST);
}
List<?> l = (List<?>) right;
Object low = l.get(0);
Object high = l.get(1);
TypeComparator comparator = state.getTypeComparator();
try {
return BooleanTypedValue.forValue((comparator.compare(left, low) >= 0 && comparator.compare(left, high) <= 0));
} catch (SpelEvaluationException ex) {
ex.setPosition(getStartPosition());
throw ex;
}
}
示例6: getValueInternal
import org.springframework.expression.spel.SpelEvaluationException; //导入方法依赖的package包/类
@Override
public TypedValue getValueInternal(ExpressionState state) throws EvaluationException {
TypedValue o = state.lookupVariable(name);
if (o == null) {
throw new SpelEvaluationException(getStartPosition(), SpelMessage.FUNCTION_NOT_DEFINED, name);
}
// Two possibilities: a lambda function or a Java static method registered as a function
if (!(o.getValue() instanceof Method)) {
throw new SpelEvaluationException(SpelMessage.FUNCTION_REFERENCE_CANNOT_BE_INVOKED, name, o.getClass());
}
try {
return executeFunctionJLRMethod(state, (Method) o.getValue());
}
catch (SpelEvaluationException se) {
se.setPosition(getStartPosition());
throw se;
}
}
示例7: getBooleanValue
import org.springframework.expression.spel.SpelEvaluationException; //导入方法依赖的package包/类
private boolean getBooleanValue(ExpressionState state, SpelNodeImpl operand) {
try {
Boolean value = operand.getValue(state, Boolean.class);
assertValueNotNull(value);
return value;
}
catch (SpelEvaluationException ex) {
ex.setPosition(operand.getStartPosition());
throw ex;
}
}
示例8: getBooleanValue
import org.springframework.expression.spel.SpelEvaluationException; //导入方法依赖的package包/类
private boolean getBooleanValue(ExpressionState state, SpelNodeImpl operand) {
try {
Boolean value = operand.getValue(state, Boolean.class);
assertValueNotNull(value);
return value;
}
catch (SpelEvaluationException ee) {
ee.setPosition(operand.getStartPosition());
throw ee;
}
}
示例9: getValueInternal
import org.springframework.expression.spel.SpelEvaluationException; //导入方法依赖的package包/类
@Override
public BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException {
try {
Boolean value = this.children[0].getValue(state, Boolean.class);
if (value == null) {
throw new SpelEvaluationException(SpelMessage.TYPE_CONVERSION_ERROR, "null", "boolean");
}
return BooleanTypedValue.forValue(!value);
}
catch (SpelEvaluationException ex) {
ex.setPosition(getChild(0).getStartPosition());
throw ex;
}
}
示例10: getValueRef
import org.springframework.expression.spel.SpelEvaluationException; //导入方法依赖的package包/类
@Override
protected ValueRef getValueRef(ExpressionState state) throws EvaluationException {
if (getChildCount() == 1) {
return this.children[0].getValueRef(state);
}
SpelNodeImpl nextNode = this.children[0];
try {
TypedValue result = nextNode.getValueInternal(state);
int cc = getChildCount();
for (int i = 1; i < cc - 1; i++) {
try {
state.pushActiveContextObject(result);
nextNode = this.children[i];
result = nextNode.getValueInternal(state);
}
finally {
state.popActiveContextObject();
}
}
try {
state.pushActiveContextObject(result);
nextNode = this.children[cc-1];
return nextNode.getValueRef(state);
}
finally {
state.popActiveContextObject();
}
}
catch (SpelEvaluationException ee) {
// Correct the position for the error before re-throwing
ee.setPosition(nextNode.getStartPosition());
throw ee;
}
}
示例11: getValueRef
import org.springframework.expression.spel.SpelEvaluationException; //导入方法依赖的package包/类
@Override
protected ValueRef getValueRef(ExpressionState state) throws EvaluationException {
if (getChildCount() == 1) {
return this.children[0].getValueRef(state);
}
SpelNodeImpl nextNode = this.children[0];
try {
TypedValue result = nextNode.getValueInternal(state);
int cc = getChildCount();
for (int i = 1; i < cc - 1; i++) {
try {
state.pushActiveContextObject(result);
nextNode = this.children[i];
result = nextNode.getValueInternal(state);
}
finally {
state.popActiveContextObject();
}
}
try {
state.pushActiveContextObject(result);
nextNode = this.children[cc - 1];
return nextNode.getValueRef(state);
}
finally {
state.popActiveContextObject();
}
}
catch (SpelEvaluationException ex) {
// Correct the position for the error before re-throwing
ex.setPosition(nextNode.getStartPosition());
throw ex;
}
}
示例12: getValueInternal
import org.springframework.expression.spel.SpelEvaluationException; //导入方法依赖的package包/类
@Override
public BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException {
try {
Boolean value = children[0].getValue(state, Boolean.class);
if (value == null) {
throw new SpelEvaluationException(SpelMessage.TYPE_CONVERSION_ERROR, "null", "boolean");
}
return BooleanTypedValue.forValue(!value);
}
catch (SpelEvaluationException see) {
see.setPosition(getChild(0).getStartPosition());
throw see;
}
}
示例13: getValueRef
import org.springframework.expression.spel.SpelEvaluationException; //导入方法依赖的package包/类
@Override
protected ValueRef getValueRef(ExpressionState state) throws EvaluationException {
if (getChildCount()==1) {
return children[0].getValueRef(state);
}
TypedValue result = null;
SpelNodeImpl nextNode = null;
try {
nextNode = children[0];
result = nextNode.getValueInternal(state);
int cc = getChildCount();
for (int i = 1; i < cc-1; i++) {
try {
state.pushActiveContextObject(result);
nextNode = children[i];
result = nextNode.getValueInternal(state);
} finally {
state.popActiveContextObject();
}
}
try {
state.pushActiveContextObject(result);
nextNode = children[cc-1];
return nextNode.getValueRef(state);
} finally {
state.popActiveContextObject();
}
} catch (SpelEvaluationException ee) {
// Correct the position for the error before re-throwing
ee.setPosition(nextNode.getStartPosition());
throw ee;
}
}