Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
84a4fe6d
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
84a4fe6d
编写于
12月 13, 2008
作者:
A
Andy Clement
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove files
上级
6d03f881
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
0 addition
and
597 deletion
+0
-597
org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/SpelNode.java
...ava/org/springframework/expression/spel/ast/SpelNode.java
+0
-126
org.springframework.expression/src/main/java/org/springframework/expression/spel/internal/EmptySpelNode.java
...ringframework/expression/spel/internal/EmptySpelNode.java
+0
-39
org.springframework.expression/src/main/java/org/springframework/expression/spel/internal/InternalELException.java
...amework/expression/spel/internal/InternalELException.java
+0
-35
org.springframework.expression/src/main/java/org/springframework/expression/spel/internal/SpelTreeAdaptor.java
...ngframework/expression/spel/internal/SpelTreeAdaptor.java
+0
-172
org.springframework.expression/src/main/java/org/springframework/expression/spel/internal/SpringExpressionsLexerExtender.java
...ression/spel/internal/SpringExpressionsLexerExtender.java
+0
-81
org.springframework.expression/src/main/java/org/springframework/expression/spel/internal/SpringExpressionsParserExtender.java
...ession/spel/internal/SpringExpressionsParserExtender.java
+0
-87
org.springframework.expression/src/main/java/org/springframework/expression/spel/internal/VariableScope.java
...ringframework/expression/spel/internal/VariableScope.java
+0
-57
未找到文件。
org.springframework.expression/src/main/java/org/springframework/expression/spel/ast/SpelNode.java
已删除
100644 → 0
浏览文件 @
6d03f881
/*
* Copyright 2004-2008 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.expression.spel.ast
;
import
java.io.Serializable
;
import
org.antlr.runtime.Token
;
import
org.antlr.runtime.tree.CommonTree
;
import
org.springframework.expression.EvaluationException
;
import
org.springframework.expression.common.ExpressionUtils
;
import
org.springframework.expression.spel.ExpressionState
;
import
org.springframework.expression.spel.SpelException
;
import
org.springframework.expression.spel.SpelMessages
;
import
org.springframework.expression.spel.generated.SpringExpressionsParser
;
/**
* The common supertype of all AST nodes in a parsed Spring Expression Language format expression.
*
* @author Andy Clement
*
*/
public
abstract
class
SpelNode
extends
CommonTree
implements
Serializable
{
/**
* The Antlr parser uses this constructor to build SpelNodes.
*
* @param payload the token for the node that has been parsed
*/
protected
SpelNode
(
Token
payload
)
{
super
(
payload
);
}
/**
* Evaluate the expression node in the context of the supplied expression state and return the value.
*
* @param expressionState the current expression state (includes the context)
* @return the value of this node evaluated against the specified state
*/
public
abstract
Object
getValue
(
ExpressionState
expressionState
)
throws
EvaluationException
;
/**
* Determine if this expression node will support a setValue() call.
*
* @param expressionState the current expression state (includes the context)
* @return true if the expression node will allow setValue()
* @throws EvaluationException if something went wrong trying to determine if the node supports writing
*/
public
boolean
isWritable
(
ExpressionState
expressionState
)
throws
EvaluationException
{
return
false
;
}
/**
* Evaluate the expression to a node and then set the new value on that node. For example, if the expression
* evaluates to a property reference then the property will be set to the new value.
*
* @param expressionState the current expression state (includes the context)
* @param newValue the new value
* @throws EvaluationException if any problem occurs evaluating the expression or setting the new value
*/
public
void
setValue
(
ExpressionState
expressionState
,
Object
newValue
)
throws
EvaluationException
{
throw
new
SpelException
(
getCharPositionInLine
(),
SpelMessages
.
SETVALUE_NOT_SUPPORTED
,
getClass
(),
getTokenName
());
}
/**
* @return return the token this node represents
*/
protected
String
getTokenName
()
{
if
(
getToken
()
==
null
)
{
return
"UNKNOWN"
;
}
return
SpringExpressionsParser
.
tokenNames
[
getToken
().
getType
()];
}
/**
* @return the string form of this AST node
*/
public
abstract
String
toStringAST
();
/**
* Helper method that returns a SpelNode rather than an Antlr Tree node.
*
* @return the child node cast to a SpelNode
*/
@Override
public
SpelNode
getChild
(
int
index
)
{
return
(
SpelNode
)
super
.
getChild
(
index
);
}
/**
* Determine the class of the object passed in, unless it is already a class object.
* @param o the object that the caller wants the class of
* @return the class of the object if it is not already a class object, or null if the object is null
*/
public
Class
<?>
getObjectClass
(
Object
o
)
{
if
(
o
==
null
)
return
null
;
return
(
o
instanceof
Class
)
?
((
Class
<?>)
o
)
:
o
.
getClass
();
}
protected
final
Object
getValue
(
ExpressionState
state
,
Class
<?>
desiredReturnType
)
throws
EvaluationException
{
Object
result
=
getValue
(
state
);
if
(
result
!=
null
&&
desiredReturnType
!=
null
)
{
Class
<?>
resultType
=
result
.
getClass
();
if
(
desiredReturnType
.
isAssignableFrom
(
resultType
))
{
return
result
;
}
// Attempt conversion to the requested type, may throw an exception
return
ExpressionUtils
.
convert
(
state
.
getEvaluationContext
(),
result
,
desiredReturnType
);
}
return
result
;
}
}
org.springframework.expression/src/main/java/org/springframework/expression/spel/internal/EmptySpelNode.java
已删除
100644 → 0
浏览文件 @
6d03f881
/*
* Copyright 2004-2008 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.expression.spel.internal
;
import
org.antlr.runtime.Token
;
import
org.springframework.expression.spel.SpelException
;
import
org.springframework.expression.spel.ExpressionState
;
import
org.springframework.expression.spel.ast.SpelNode
;
public
class
EmptySpelNode
extends
SpelNode
{
public
EmptySpelNode
(
Token
payload
)
{
super
(
payload
);
}
@Override
public
Object
getValue
(
ExpressionState
state
)
throws
SpelException
{
throw
new
RuntimeException
(
"?"
);
}
@Override
public
String
toStringAST
()
{
return
"<no string form node '"
+
getTokenName
()
+
"'>"
;
}
}
org.springframework.expression/src/main/java/org/springframework/expression/spel/internal/InternalELException.java
已删除
100644 → 0
浏览文件 @
6d03f881
/*
* Copyright 2004-2008 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.expression.spel.internal
;
import
org.springframework.expression.spel.SpelException
;
/**
* Wraps an ELException and can pass up through Antlr since it is unchecked, where it can then be unwrapped.
*
* @author Andy Clement
*/
public
class
InternalELException
extends
RuntimeException
{
public
InternalELException
(
SpelException
e
)
{
super
(
e
);
}
@Override
public
SpelException
getCause
()
{
return
(
SpelException
)
super
.
getCause
();
}
}
org.springframework.expression/src/main/java/org/springframework/expression/spel/internal/SpelTreeAdaptor.java
已删除
100644 → 0
浏览文件 @
6d03f881
/*
* Copyright 2004-2008 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.expression.spel.internal
;
import
org.antlr.runtime.Token
;
import
org.antlr.runtime.tree.CommonTreeAdaptor
;
import
org.springframework.expression.spel.ast.Assign
;
import
org.springframework.expression.spel.ast.BooleanLiteral
;
import
org.springframework.expression.spel.ast.CompoundExpression
;
import
org.springframework.expression.spel.ast.ConstructorReference
;
import
org.springframework.expression.spel.ast.Dot
;
import
org.springframework.expression.spel.ast.FunctionReference
;
import
org.springframework.expression.spel.ast.Identifier
;
import
org.springframework.expression.spel.ast.Indexer
;
import
org.springframework.expression.spel.ast.Literal
;
import
org.springframework.expression.spel.ast.MethodReference
;
import
org.springframework.expression.spel.ast.NullLiteral
;
import
org.springframework.expression.spel.ast.OperatorAnd
;
import
org.springframework.expression.spel.ast.OperatorBetween
;
import
org.springframework.expression.spel.ast.OperatorDivide
;
import
org.springframework.expression.spel.ast.OperatorEquality
;
import
org.springframework.expression.spel.ast.OperatorGreaterThan
;
import
org.springframework.expression.spel.ast.OperatorGreaterThanOrEqual
;
import
org.springframework.expression.spel.ast.OperatorInequality
;
import
org.springframework.expression.spel.ast.OperatorInstanceof
;
import
org.springframework.expression.spel.ast.OperatorLessThan
;
import
org.springframework.expression.spel.ast.OperatorLessThanOrEqual
;
import
org.springframework.expression.spel.ast.OperatorMatches
;
import
org.springframework.expression.spel.ast.OperatorMinus
;
import
org.springframework.expression.spel.ast.OperatorModulus
;
import
org.springframework.expression.spel.ast.OperatorMultiply
;
import
org.springframework.expression.spel.ast.OperatorNot
;
import
org.springframework.expression.spel.ast.OperatorOr
;
import
org.springframework.expression.spel.ast.OperatorPlus
;
import
org.springframework.expression.spel.ast.Placeholder
;
import
org.springframework.expression.spel.ast.Projection
;
import
org.springframework.expression.spel.ast.PropertyOrFieldReference
;
import
org.springframework.expression.spel.ast.QualifiedIdentifier
;
import
org.springframework.expression.spel.ast.RealLiteral
;
import
org.springframework.expression.spel.ast.Selection
;
import
org.springframework.expression.spel.ast.StringLiteral
;
import
org.springframework.expression.spel.ast.Ternary
;
import
org.springframework.expression.spel.ast.TypeReference
;
import
org.springframework.expression.spel.ast.VariableReference
;
import
org.springframework.expression.spel.generated.SpringExpressionsLexer
;
public
class
SpelTreeAdaptor
extends
CommonTreeAdaptor
{
@Override
public
Object
create
(
Token
payload
)
{
if
(
payload
!=
null
)
{
switch
(
payload
.
getType
())
{
case
SpringExpressionsLexer
.
TRUE
:
return
new
BooleanLiteral
(
payload
,
true
);
case
SpringExpressionsLexer
.
FALSE
:
return
new
BooleanLiteral
(
payload
,
false
);
case
SpringExpressionsLexer
.
OR
:
return
new
OperatorOr
(
payload
);
case
SpringExpressionsLexer
.
AND
:
return
new
OperatorAnd
(
payload
);
case
SpringExpressionsLexer
.
BANG
:
return
new
OperatorNot
(
payload
);
case
SpringExpressionsLexer
.
REAL_LITERAL
:
return
new
RealLiteral
(
payload
);
case
SpringExpressionsLexer
.
INTEGER_LITERAL
:
return
Literal
.
getIntLiteral
(
payload
,
10
);
case
SpringExpressionsLexer
.
HEXADECIMAL_INTEGER_LITERAL
:
return
Literal
.
getIntLiteral
(
payload
,
16
);
case
SpringExpressionsLexer
.
NOT_EQUAL
:
return
new
OperatorInequality
(
payload
);
case
SpringExpressionsLexer
.
EQUAL
:
return
new
OperatorEquality
(
payload
);
case
SpringExpressionsLexer
.
GREATER_THAN
:
return
new
OperatorGreaterThan
(
payload
);
case
SpringExpressionsLexer
.
LESS_THAN
:
return
new
OperatorLessThan
(
payload
);
case
SpringExpressionsLexer
.
LESS_THAN_OR_EQUAL
:
return
new
OperatorLessThanOrEqual
(
payload
);
case
SpringExpressionsLexer
.
GREATER_THAN_OR_EQUAL
:
return
new
OperatorGreaterThanOrEqual
(
payload
);
case
SpringExpressionsLexer
.
PLUS
:
return
new
OperatorPlus
(
payload
);
case
SpringExpressionsLexer
.
MINUS
:
return
new
OperatorMinus
(
payload
);
case
SpringExpressionsLexer
.
STAR
/* MULTIPLY */
:
return
new
OperatorMultiply
(
payload
);
case
SpringExpressionsLexer
.
DIV
/* DIVIDE */
:
return
new
OperatorDivide
(
payload
);
case
SpringExpressionsLexer
.
MOD
:
return
new
OperatorModulus
(
payload
);
case
SpringExpressionsLexer
.
STRING_LITERAL
:
case
SpringExpressionsLexer
.
DQ_STRING_LITERAL
:
return
new
StringLiteral
(
payload
);
case
SpringExpressionsLexer
.
NULL_LITERAL
:
return
new
NullLiteral
(
payload
);
case
SpringExpressionsLexer
.
ID
:
return
new
Identifier
(
payload
);
case
SpringExpressionsLexer
.
PROPERTY_OR_FIELD
:
return
new
PropertyOrFieldReference
(
payload
);
case
SpringExpressionsLexer
.
METHOD
:
return
new
MethodReference
(
payload
);
case
SpringExpressionsLexer
.
QUALIFIED_IDENTIFIER
:
return
new
QualifiedIdentifier
(
payload
);
case
SpringExpressionsLexer
.
TYPEREF
:
return
new
TypeReference
(
payload
);
case
SpringExpressionsLexer
.
EXPRESSION
:
return
new
CompoundExpression
(
payload
);
case
SpringExpressionsLexer
.
CONSTRUCTOR
:
return
new
ConstructorReference
(
payload
,
false
);
case
SpringExpressionsLexer
.
VARIABLEREF
:
return
new
VariableReference
(
payload
);
case
SpringExpressionsLexer
.
FUNCTIONREF
:
return
new
FunctionReference
(
payload
);
case
SpringExpressionsLexer
.
PROJECT
:
return
new
Projection
(
payload
);
case
SpringExpressionsLexer
.
SELECT
:
return
new
Selection
(
payload
,
Selection
.
ALL
);
case
SpringExpressionsLexer
.
SELECT_FIRST
:
return
new
Selection
(
payload
,
Selection
.
FIRST
);
case
SpringExpressionsLexer
.
SELECT_LAST
:
return
new
Selection
(
payload
,
Selection
.
LAST
);
case
SpringExpressionsLexer
.
ASSIGN
:
return
new
Assign
(
payload
);
case
SpringExpressionsLexer
.
QMARK
:
return
new
Ternary
(
payload
);
case
SpringExpressionsLexer
.
INDEXER
:
return
new
Indexer
(
payload
);
case
SpringExpressionsLexer
.
BETWEEN
:
return
new
OperatorBetween
(
payload
);
case
SpringExpressionsLexer
.
MATCHES
:
return
new
OperatorMatches
(
payload
);
case
SpringExpressionsLexer
.
INSTANCEOF
:
return
new
OperatorInstanceof
(
payload
);
case
SpringExpressionsLexer
.
RPAREN
:
return
new
Placeholder
(
payload
);
case
SpringExpressionsLexer
.
COLON
:
return
new
Placeholder
(
payload
);
case
SpringExpressionsLexer
.
DOT
:
return
new
Dot
(
payload
);
default
:
throw
new
RuntimeException
(
"Not implemented for '"
+
payload
+
"' "
+
getToken
(
payload
)
+
"' "
+
payload
.
getType
());
}
}
return
new
EmptySpelNode
(
payload
);
}
}
\ No newline at end of file
org.springframework.expression/src/main/java/org/springframework/expression/spel/internal/SpringExpressionsLexerExtender.java
已删除
100644 → 0
浏览文件 @
6d03f881
/*
* Copyright 2004-2008 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.expression.spel.internal
;
import
org.antlr.runtime.RecognitionException
;
import
org.springframework.expression.spel.SpelException
;
import
org.springframework.expression.spel.SpelMessages
;
import
org.springframework.expression.spel.generated.SpringExpressionsLexer
;
public
class
SpringExpressionsLexerExtender
extends
SpringExpressionsLexer
{
public
SpringExpressionsLexerExtender
()
{
super
();
}
/**
* recover() attempts to provide better error messages once something has gone wrong. It then throws a
* InternalELException (has to be this unchecked exception as the exception must flow through Antlr lexer methods
* that do not have declared exceptions). The InternalELException will be caught at the top level and altered to
* include context (line,column) information before being rethrown.<br>
*
* This error analysis code is in recover() rather than reportError() because reportError() isn't always called by
* the lexer and there is no way to add the calls to it by editing the .g file.
*/
@Override
public
void
recover
(
RecognitionException
re
)
{
// TODO recovery needs an overhaul once the expression language syntax is agreed
// List<?> rules = getRuleInvocationStack(re, SpringExpressionsLexer.class.getName());
// String failedRule = (String) rules.get(rules.size() - 1);
// System.out.println("DBG: lexer rule " + failedRule);
// need a concrete example of error recovery in here please! then i can delete the below
// if (re instanceof NoViableAltException) {
// NoViableAltException nvae = (NoViableAltException) re;
// // example error data: { "abc": def }
// if (failedRule.equals("mTokens") && Character.isLetter((char) (nvae.getUnexpectedType()))) {
// logger.error(ParserMessage.ERROR_STRINGS_MUST_BE_QUOTED, re.line, re.charPositionInLine);
// }
//
// } else if (re instanceof MismatchedRangeException) {
// // MismatchedRangeException mre = (MismatchedRangeException) re;
// // example error data: [ 123e ]
// if (failedRule.equals("mDIGIT") && rules.size() > 3 && ((String) rules.get(rules.size() -
// 3)).equals("mExponent")) {
// logger.error(ParserMessage.ERROR_INVALID_EXPONENT, re.line, re.charPositionInLine);
// }
// } else if (re instanceof MismatchedTokenException) {
// MismatchedTokenException mte = (MismatchedTokenException) re;
// logger.error(ParserMessage.ERROR_MISMATCHED_CHARACTER, mte.charPositionInLine, mte.charPositionInLine,
// getCharErrorDisplay(mte.expecting), getCharErrorDisplay(mte.c));
// }
SpelException
realException
=
new
SpelException
(
re
,
SpelMessages
.
RECOGNITION_ERROR
,
re
.
toString
());
throw
new
InternalELException
(
realException
);
}
@Override
public
void
reportError
(
RecognitionException
re
)
{
// Do not report anything. If better messages could be reported they will have been reported
// by the recover() method above.
}
// private String getTokenForId(int id) {
// if (id == -1)
// return "EOF";
// return getTokenNames()[id];
// }
}
org.springframework.expression/src/main/java/org/springframework/expression/spel/internal/SpringExpressionsParserExtender.java
已删除
100644 → 0
浏览文件 @
6d03f881
/*
* Copyright 2004-2008 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.expression.spel.internal
;
import
org.antlr.runtime.BitSet
;
import
org.antlr.runtime.IntStream
;
import
org.antlr.runtime.RecognitionException
;
import
org.antlr.runtime.Token
;
import
org.antlr.runtime.TokenStream
;
import
org.springframework.expression.spel.SpelException
;
import
org.springframework.expression.spel.SpelMessages
;
import
org.springframework.expression.spel.generated.SpringExpressionsParser
;
public
class
SpringExpressionsParserExtender
extends
SpringExpressionsParser
{
public
SpringExpressionsParserExtender
(
TokenStream
input
)
{
super
(
input
);
}
/**
* Override super type implementation and just include the character position rather than the line number since the
* expressions are nearly all going to be just one line.
*/
@Override
public
String
getErrorHeader
(
RecognitionException
e
)
{
StringBuilder
retval
=
new
StringBuilder
();
retval
.
append
(
"(pos "
).
append
(
e
.
charPositionInLine
).
append
(
"): "
);
return
retval
.
toString
();
}
@Override
public
void
displayRecognitionError
(
String
[]
tokenNames
,
RecognitionException
e
)
{
String
message
=
getErrorMessage
(
e
,
tokenNames
);
// TODO would something like this be worthwhile to improve messages?
// if (message.equals("no viable alternative at input '<EOF>'") && !paraphrase.isEmpty()) {
// // This means we ran out of input building something, that something is named in paraphrase
// message = "no more input data to process whilst constructing " + paraphrase.peek();
// }
SpelException
parsingProblem
=
new
SpelException
(
e
.
charPositionInLine
,
e
,
SpelMessages
.
PARSE_PROBLEM
,
message
);
throw
new
InternalELException
(
parsingProblem
);
}
/**
* Overridden purely because the base implementation does a System.err.println()
*/
@Override
public
void
recoverFromMismatchedToken
(
IntStream
input
,
RecognitionException
e
,
int
ttype
,
BitSet
follow
)
throws
RecognitionException
{
// if next token is what we are looking for then "delete" this token
if
(
input
.
LA
(
2
)
==
ttype
)
{
reportError
(
e
);
/*
* System.err.println("recoverFromMismatchedToken deleting "+input.LT(1)+ " since "+input.LT(2)+" is what we
* want");
*/
beginResync
();
input
.
consume
();
// simply delete extra token
endResync
();
input
.
consume
();
// move past ttype token as if all were ok
return
;
}
if
(!
recoverFromMismatchedElement
(
input
,
e
,
follow
))
{
throw
e
;
}
}
@Override
public
String
getTokenErrorDisplay
(
Token
t
)
{
if
(
t
==
null
)
{
return
"<unknown>"
;
}
return
super
.
getTokenErrorDisplay
(
t
);
}
}
org.springframework.expression/src/main/java/org/springframework/expression/spel/internal/VariableScope.java
已删除
100644 → 0
浏览文件 @
6d03f881
/*
* Copyright 2004-2008 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.expression.spel.internal
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* A new scope is entered when a function is called and it is used to hold the parameters to the function call. If the names
* of the parameters clash with those in a higher level scope, those in the higher level scope will not be accessible whilst
* the function is executing. When the function returns the scope is exited.
*
* @author Andy Clement
*
*/
public
class
VariableScope
{
private
final
Map
<
String
,
Object
>
vars
=
new
HashMap
<
String
,
Object
>();
public
VariableScope
()
{
}
public
VariableScope
(
Map
<
String
,
Object
>
arguments
)
{
if
(
arguments
!=
null
)
{
vars
.
putAll
(
arguments
);
}
}
public
VariableScope
(
String
name
,
Object
value
)
{
vars
.
put
(
name
,
value
);
}
public
Object
lookupVariable
(
String
name
)
{
return
vars
.
get
(
name
);
}
public
void
setVariable
(
String
name
,
Object
value
)
{
vars
.
put
(
name
,
value
);
}
public
boolean
definesVariable
(
String
name
)
{
return
vars
.
containsKey
(
name
);
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录