Polishing

This commit is contained in:
Juergen Hoeller
2017-09-27 01:34:11 +02:00
parent a4b2ae583e
commit efce7902c4
43 changed files with 107 additions and 98 deletions

View File

@@ -90,6 +90,7 @@ public abstract class TemplateAwareExpressionParser implements ExpressionParser
String prefix = context.getExpressionPrefix();
String suffix = context.getExpressionSuffix();
int startIdx = 0;
while (startIdx < expressionString.length()) {
int prefixIndex = expressionString.indexOf(prefix, startIdx);
if (prefixIndex >= startIdx) {
@@ -104,22 +105,18 @@ public abstract class TemplateAwareExpressionParser implements ExpressionParser
"No ending suffix '" + suffix + "' for expression starting at character " +
prefixIndex + ": " + expressionString.substring(prefixIndex));
}
if (suffixIndex == afterPrefixIndex) {
throw new ParseException(expressionString, prefixIndex,
"No expression defined within delimiter '" + prefix + suffix +
"' at character " + prefixIndex);
}
String expr = expressionString.substring(prefixIndex + prefix.length(), suffixIndex);
expr = expr.trim();
if (expr.isEmpty()) {
throw new ParseException(expressionString, prefixIndex,
"No expression defined within delimiter '" + prefix + suffix +
"' at character " + prefixIndex);
}
expressions.add(doParseExpression(expr, context));
startIdx = suffixIndex + suffix.length();
}
@@ -129,6 +126,7 @@ public abstract class TemplateAwareExpressionParser implements ExpressionParser
startIdx = expressionString.length();
}
}
return expressions.toArray(new Expression[expressions.size()]);
}

View File

@@ -62,7 +62,7 @@ public class FunctionReference extends SpelNodeImpl {
public FunctionReference(String functionName, int pos, SpelNodeImpl... arguments) {
super(pos,arguments);
super(pos, arguments);
this.name = functionName;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -196,9 +196,9 @@ public abstract class SpelNodeImpl implements SpelNode, Opcodes {
/**
* Generate code that handles building the argument values for the specified method. This method will take account
* of whether the invoked method is a varargs method and if it is then the argument values will be appropriately
* packaged into an array.
* Generate code that handles building the argument values for the specified method.
* This method will take account of whether the invoked method is a varargs method
* and if it is then the argument values will be appropriately packaged into an array.
* @param mv the method visitor where code should be generated
* @param cf the current codeflow
* @param member the method or constructor for which arguments are being setup
@@ -208,7 +208,7 @@ public abstract class SpelNodeImpl implements SpelNode, Opcodes {
String[] paramDescriptors = null;
boolean isVarargs = false;
if (member instanceof Constructor) {
Constructor<?> ctor = (Constructor<?>)member;
Constructor<?> ctor = (Constructor<?>) member;
paramDescriptors = CodeFlow.toDescriptors(ctor.getParameterTypes());
isVarargs = ctor.isVarArgs();
}

View File

@@ -59,6 +59,7 @@ public class ReflectiveMethodExecutor implements MethodExecutor {
}
}
public Method getMethod() {
return this.method;
}