本文整理汇总了Java中org.springframework.expression.spel.SpelParseException类的典型用法代码示例。如果您正苦于以下问题:Java SpelParseException类的具体用法?Java SpelParseException怎么用?Java SpelParseException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpelParseException类属于org.springframework.expression.spel包,在下文中一共展示了SpelParseException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doParseExpression
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
@Override
protected SpelExpression doParseExpression(String expressionString, ParserContext context) throws ParseException {
try {
this.expressionString = expressionString;
Tokenizer tokenizer = new Tokenizer(expressionString);
tokenizer.process();
this.tokenStream = tokenizer.getTokens();
this.tokenStreamLength = this.tokenStream.size();
this.tokenStreamPointer = 0;
this.constructedNodes.clear();
SpelNodeImpl ast = eatExpression();
if (moreTokens()) {
throw new SpelParseException(peekToken().startpos,SpelMessage.MORE_INPUT,toString(nextToken()));
}
Assert.isTrue(this.constructedNodes.isEmpty());
return new SpelExpression(expressionString, ast, this.configuration);
}
catch (InternalParseException ipe) {
throw ipe.getCause();
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:InternalSpelExpressionParser.java
示例2: lexQuotedStringLiteral
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
private void lexQuotedStringLiteral() {
int start = this.pos;
boolean terminated = false;
while (!terminated) {
this.pos++;
char ch = this.toProcess[this.pos];
if (ch == '\'') {
// may not be the end if the char after is also a '
if (this.toProcess[this.pos + 1] == '\'') {
this.pos++; // skip over that too, and continue
}
else {
terminated = true;
}
}
if (ch == 0) {
throw new InternalParseException(new SpelParseException(this.expressionString,
start, SpelMessage.NON_TERMINATING_QUOTED_STRING));
}
}
this.pos++;
this.tokens.add(new Token(TokenKind.LITERAL_STRING, subarray(start, this.pos), start, this.pos));
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:Tokenizer.java
示例3: lexDoubleQuotedStringLiteral
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
private void lexDoubleQuotedStringLiteral() {
int start = this.pos;
boolean terminated = false;
while (!terminated) {
this.pos++;
char ch = this.toProcess[this.pos];
if (ch == '"') {
// may not be the end if the char after is also a "
if (this.toProcess[this.pos + 1] == '"') {
this.pos++; // skip over that too, and continue
}
else {
terminated = true;
}
}
if (ch == 0) {
throw new InternalParseException(new SpelParseException(this.expressionString,
start, SpelMessage.NON_TERMINATING_DOUBLE_QUOTED_STRING));
}
}
this.pos++;
this.tokens.add(new Token(TokenKind.LITERAL_STRING, subarray(start, this.pos), start, this.pos));
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:Tokenizer.java
示例4: pushHexIntToken
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
private void pushHexIntToken(char[] data, boolean isLong, int start, int end) {
if (data.length == 0) {
if (isLong) {
throw new InternalParseException(new SpelParseException(this.expressionString,
start, SpelMessage.NOT_A_LONG, this.expressionString.substring(start,
end + 1)));
}
else {
throw new InternalParseException(new SpelParseException(this.expressionString,
start, SpelMessage.NOT_AN_INTEGER, this.expressionString.substring(
start, end)));
}
}
if (isLong) {
this.tokens.add(new Token(TokenKind.LITERAL_HEXLONG, data, start, end));
}
else {
this.tokens.add(new Token(TokenKind.LITERAL_HEXINT, data, start, end));
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:Tokenizer.java
示例5: doParseExpression
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
@Override
protected SpelExpression doParseExpression(String expressionString, ParserContext context) throws ParseException {
try {
this.expressionString = expressionString;
Tokenizer tokenizer = new Tokenizer(expressionString);
tokenizer.process();
this.tokenStream = tokenizer.getTokens();
this.tokenStreamLength = this.tokenStream.size();
this.tokenStreamPointer = 0;
this.constructedNodes.clear();
SpelNodeImpl ast = eatExpression();
if (moreTokens()) {
throw new SpelParseException(peekToken().startPos, SpelMessage.MORE_INPUT, toString(nextToken()));
}
Assert.isTrue(this.constructedNodes.isEmpty());
return new SpelExpression(expressionString, ast, this.configuration);
}
catch (InternalParseException ex) {
throw ex.getCause();
}
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:22,代码来源:InternalSpelExpressionParser.java
示例6: lexQuotedStringLiteral
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
private void lexQuotedStringLiteral() {
int start = this.pos;
boolean terminated = false;
while (!terminated) {
this.pos++;
char ch = this.toProcess[this.pos];
if (ch == '\'') {
// may not be the end if the char after is also a '
if (this.toProcess[this.pos + 1] == '\'') {
this.pos++; // skip over that too, and continue
}
else {
terminated = true;
}
}
if (ch == 0) {
throw new InternalParseException(new SpelParseException(this.expressionString, start,
SpelMessage.NON_TERMINATING_QUOTED_STRING));
}
}
this.pos++;
this.tokens.add(new Token(TokenKind.LITERAL_STRING, subarray(start, this.pos), start, this.pos));
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:24,代码来源:Tokenizer.java
示例7: resolveExpressionsForParagraph
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void resolveExpressionsForParagraph(P p, T expressionContext, WordprocessingMLPackage document) {
ParagraphWrapper paragraphWrapper = new ParagraphWrapper(p);
List<String> placeholders = expressionUtil.findVariableExpressions(paragraphWrapper.getText());
for (String placeholder : placeholders) {
try {
Object replacement = expressionResolver.resolveExpression(placeholder, expressionContext);
if (replacement != null) {
ITypeResolver resolver = typeResolverRegistry.getResolverForType(replacement.getClass());
Object replacementObject = resolver.resolve(document, replacement);
replace(paragraphWrapper, placeholder, replacementObject);
logger.debug(String.format("Replaced expression '%s' with value provided by TypeResolver %s", placeholder, resolver.getClass()));
}
} catch (SpelEvaluationException | SpelParseException e) {
logger.warn(String.format(
"Expression %s could not be resolved against context root of type %s. Reason: %s. Set log level to TRACE to view Stacktrace.",
placeholder, expressionContext.getClass(), e.getMessage()));
logger.trace("Reason for skipping expression:", e);
}
}
if (this.lineBreakPlaceholder != null) {
replaceLineBreaks(paragraphWrapper);
}
}
开发者ID:thombergs,项目名称:docx-stamper,代码行数:25,代码来源:PlaceholderReplacer.java
示例8: doParseExpression
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
@Override
protected SpelExpression doParseExpression(String expressionString, ParserContext context) throws ParseException {
try {
this.expressionString = expressionString;
Tokenizer tokenizer = new Tokenizer(expressionString);
tokenizer.process();
tokenStream = tokenizer.getTokens();
tokenStreamLength = tokenStream.size();
tokenStreamPointer = 0;
constructedNodes.clear();
SpelNodeImpl ast = eatExpression();
if (moreTokens()) {
throw new SpelParseException(peekToken().startpos,SpelMessage.MORE_INPUT,toString(nextToken()));
}
Assert.isTrue(constructedNodes.isEmpty());
return new SpelExpression(expressionString, ast, configuration);
}
catch (InternalParseException ipe) {
throw ipe.getCause();
}
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:22,代码来源:InternalSpelExpressionParser.java
示例9: lexQuotedStringLiteral
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
private void lexQuotedStringLiteral() {
int start = pos;
boolean terminated = false;
while (!terminated) {
pos++;
char ch = toProcess[pos];
if (ch=='\'') {
// may not be the end if the char after is also a '
if (toProcess[pos+1]=='\'') {
pos++; // skip over that too, and continue
} else {
terminated = true;
}
}
if (ch==0) {
throw new InternalParseException(new SpelParseException(expressionString,start,SpelMessage.NON_TERMINATING_QUOTED_STRING));
}
}
pos++;
tokens.add(new Token(TokenKind.LITERAL_STRING, subarray(start,pos), start, pos));
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:22,代码来源:Tokenizer.java
示例10: lexDoubleQuotedStringLiteral
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
private void lexDoubleQuotedStringLiteral() {
int start = pos;
boolean terminated = false;
while (!terminated) {
pos++;
char ch = toProcess[pos];
if (ch=='"') {
// may not be the end if the char after is also a "
if (toProcess[pos+1]=='"') {
pos++; // skip over that too, and continue
} else {
terminated = true;
}
}
if (ch==0) {
throw new InternalParseException(new SpelParseException(expressionString,start,SpelMessage.NON_TERMINATING_DOUBLE_QUOTED_STRING));
}
}
pos++;
tokens.add(new Token(TokenKind.LITERAL_STRING, subarray(start,pos), start, pos));
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:22,代码来源:Tokenizer.java
示例11: getIntLiteral
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
/**
* Process the string form of a number, using the specified base if supplied and return an appropriate literal to
* hold it. Any suffix to indicate a long will be taken into account (either 'l' or 'L' is supported).
* @param numberToken the token holding the number as its payload (eg. 1234 or 0xCAFE)
* @param radix the base of number
* @return a subtype of Literal that can represent it
*/
public static Literal getIntLiteral(String numberToken, int pos, int radix) {
try {
int value = Integer.parseInt(numberToken, radix);
return new IntLiteral(numberToken, pos, value);
}
catch (NumberFormatException nfe) {
throw new InternalParseException(new SpelParseException(pos>>16, nfe, SpelMessage.NOT_AN_INTEGER, numberToken));
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:Literal.java
示例12: getLongLiteral
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
public static Literal getLongLiteral(String numberToken, int pos, int radix) {
try {
long value = Long.parseLong(numberToken, radix);
return new LongLiteral(numberToken, pos, value);
}
catch (NumberFormatException nfe) {
throw new InternalParseException(new SpelParseException(pos>>16, nfe, SpelMessage.NOT_A_LONG, numberToken));
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:Literal.java
示例13: eatConstructorArgs
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
private void eatConstructorArgs(List<SpelNodeImpl> accumulatedArguments) {
if (!peekToken(TokenKind.LPAREN)) {
throw new InternalParseException(new SpelParseException(this.expressionString,positionOf(peekToken()),SpelMessage.MISSING_CONSTRUCTOR_ARGS));
}
consumeArguments(accumulatedArguments);
eatToken(TokenKind.RPAREN);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:InternalSpelExpressionParser.java
示例14: getIntLiteral
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
/**
* Process the string form of a number, using the specified base if supplied
* and return an appropriate literal to hold it. Any suffix to indicate a
* long will be taken into account (either 'l' or 'L' is supported).
* @param numberToken the token holding the number as its payload (eg. 1234 or 0xCAFE)
* @param radix the base of number
* @return a subtype of Literal that can represent it
*/
public static Literal getIntLiteral(String numberToken, int pos, int radix) {
try {
int value = Integer.parseInt(numberToken, radix);
return new IntLiteral(numberToken, pos, value);
}
catch (NumberFormatException ex) {
throw new InternalParseException(new SpelParseException(pos>>16, ex, SpelMessage.NOT_AN_INTEGER, numberToken));
}
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:18,代码来源:Literal.java
示例15: getLongLiteral
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
public static Literal getLongLiteral(String numberToken, int pos, int radix) {
try {
long value = Long.parseLong(numberToken, radix);
return new LongLiteral(numberToken, pos, value);
}
catch (NumberFormatException ex) {
throw new InternalParseException(new SpelParseException(pos>>16, ex, SpelMessage.NOT_A_LONG, numberToken));
}
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:Literal.java
示例16: testStringLiterals_DoubleQuotes_spr9620_2
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
@Test
public void testStringLiterals_DoubleQuotes_spr9620_2() throws Exception {
try {
new SpelExpressionParser().parseRaw("\"double quote: \\\"\\\".\"");
fail("Should have failed");
} catch (SpelParseException spe) {
assertEquals(17, spe.getPosition());
assertEquals(SpelMessage.UNEXPECTED_ESCAPE_CHAR, spe.getMessageCode());
}
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:SpelParserTests.java
示例17: checkNumberError
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
private void checkNumberError(String expression, SpelMessage expectedMessage) {
try {
SpelExpressionParser parser = new SpelExpressionParser();
parser.parseRaw(expression);
fail();
} catch (ParseException e) {
assertTrue(e instanceof SpelParseException);
SpelParseException spe = (SpelParseException) e;
assertEquals(expectedMessage, spe.getMessageCode());
}
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:12,代码来源:SpelParserTests.java
示例18: parsePartitionExpression
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
private static PartitionStrategy parsePartitionExpression(String expression) {
List<String> expressions = Arrays.asList(expression.split("/"));
ExpressionParser parser = new SpelExpressionParser();
PartitionStrategy.Builder psb = new PartitionStrategy.Builder();
StandardEvaluationContext ctx = new StandardEvaluationContext(psb);
for (String expr : expressions) {
try {
Expression e = parser.parseExpression(expr);
psb = e.getValue(ctx, PartitionStrategy.Builder.class);
}
catch (SpelParseException spe) {
if (!expr.trim().endsWith(")")) {
throw new StoreException("Invalid partitioning expression '" + expr
+ "' - did you forget the closing parenthesis?", spe);
}
else {
throw new StoreException("Invalid partitioning expression '" + expr + "'!", spe);
}
}
catch (SpelEvaluationException see) {
throw new StoreException("Invalid partitioning expression '" + expr + "' - failed evaluation!", see);
}
catch (NullPointerException npe) {
throw new StoreException("Invalid partitioning expression '" + expr + "' - was evaluated to null!", npe);
}
}
return psb.build();
}
开发者ID:spring-cloud-stream-app-starters,项目名称:hdfs,代码行数:31,代码来源:HdfsDatasetSinkConfiguration.java
示例19: eatConstructorArgs
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
private void eatConstructorArgs(List<SpelNodeImpl> accumulatedArguments) {
if (!peekToken(TokenKind.LPAREN)) {
throw new InternalParseException(new SpelParseException(expressionString,positionOf(peekToken()),SpelMessage.MISSING_CONSTRUCTOR_ARGS));
}
consumeArguments(accumulatedArguments);
eatToken(TokenKind.RPAREN);
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:8,代码来源:InternalSpelExpressionParser.java
示例20: pushHexIntToken
import org.springframework.expression.spel.SpelParseException; //导入依赖的package包/类
private void pushHexIntToken(char[] data,boolean isLong, int start, int end) {
if (data.length==0) {
if (isLong) {
throw new InternalParseException(new SpelParseException(expressionString,start,SpelMessage.NOT_A_LONG,expressionString.substring(start,end+1)));
} else {
throw new InternalParseException(new SpelParseException(expressionString,start,SpelMessage.NOT_AN_INTEGER,expressionString.substring(start,end)));
}
}
if (isLong) {
tokens.add(new Token(TokenKind.LITERAL_HEXLONG, data, start, end));
} else {
tokens.add(new Token(TokenKind.LITERAL_HEXINT, data, start, end));
}
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:15,代码来源:Tokenizer.java
注:本文中的org.springframework.expression.spel.SpelParseException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论