org.springframework.expression.spel.ast.QualifiedIdentifier Java Examples

The following examples show how to use org.springframework.expression.spel.ast.QualifiedIdentifier. 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: InternalSpelExpressionParser.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Eat an identifier, possibly qualified (meaning that it is dotted).
 * TODO AndyC Could create complete identifiers (a.b.c) here rather than a sequence of them? (a, b, c)
 */
private SpelNodeImpl eatPossiblyQualifiedId() {
	Deque<SpelNodeImpl> qualifiedIdPieces = new ArrayDeque<>();
	Token node = peekToken();
	while (isValidQualifiedId(node)) {
		nextToken();
		if (node.kind != TokenKind.DOT) {
			qualifiedIdPieces.add(new Identifier(node.stringValue(), node.startPos, node.endPos));
		}
		node = peekToken();
	}
	if (qualifiedIdPieces.isEmpty()) {
		if (node == null) {
			throw internalException( this.expressionString.length(), SpelMessage.OOD);
		}
		throw internalException(node.startPos, SpelMessage.NOT_EXPECTED_TOKEN,
				"qualified ID", node.getKind().toString().toLowerCase());
	}
	return new QualifiedIdentifier(qualifiedIdPieces.getFirst().getStartPosition(),
			qualifiedIdPieces.getLast().getEndPosition(), qualifiedIdPieces.toArray(new SpelNodeImpl[0]));
}
 
Example #2
Source File: InternalSpelExpressionParser.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Eat an identifier, possibly qualified (meaning that it is dotted).
 * TODO AndyC Could create complete identifiers (a.b.c) here rather than a sequence of them? (a, b, c)
 */
private SpelNodeImpl eatPossiblyQualifiedId() {
	Deque<SpelNodeImpl> qualifiedIdPieces = new ArrayDeque<>();
	Token node = peekToken();
	while (isValidQualifiedId(node)) {
		nextToken();
		if (node.kind != TokenKind.DOT) {
			qualifiedIdPieces.add(new Identifier(node.stringValue(), toPos(node)));
		}
		node = peekToken();
	}
	if (qualifiedIdPieces.isEmpty()) {
		if (node == null) {
			throw internalException( this.expressionString.length(), SpelMessage.OOD);
		}
		throw internalException(node.startPos, SpelMessage.NOT_EXPECTED_TOKEN,
				"qualified ID", node.getKind().toString().toLowerCase());
	}
	int pos = toPos(qualifiedIdPieces.getFirst().getStartPosition(), qualifiedIdPieces.getLast().getEndPosition());
	return new QualifiedIdentifier(pos, qualifiedIdPieces.toArray(new SpelNodeImpl[0]));
}
 
Example #3
Source File: InternalSpelExpressionParser.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Eat an identifier, possibly qualified (meaning that it is dotted).
 * TODO AndyC Could create complete identifiers (a.b.c) here rather than a sequence of them? (a, b, c)
 */
private SpelNodeImpl eatPossiblyQualifiedId() {
	LinkedList<SpelNodeImpl> qualifiedIdPieces = new LinkedList<SpelNodeImpl>();
	Token node = peekToken();
	while (isValidQualifiedId(node)) {
		nextToken();
		if (node.kind != TokenKind.DOT) {
			qualifiedIdPieces.add(new Identifier(node.stringValue(), toPos(node)));
		}
		node = peekToken();
	}
	if (qualifiedIdPieces.isEmpty()) {
		if (node == null) {
			raiseInternalException( this.expressionString.length(), SpelMessage.OOD);
		}
		raiseInternalException(node.startPos, SpelMessage.NOT_EXPECTED_TOKEN,
				"qualified ID", node.getKind().toString().toLowerCase());
	}
	int pos = toPos(qualifiedIdPieces.getFirst().getStartPosition(),
			qualifiedIdPieces.getLast().getEndPosition());
	return new QualifiedIdentifier(pos,
			qualifiedIdPieces.toArray(new SpelNodeImpl[qualifiedIdPieces.size()]));
}
 
Example #4
Source File: InternalSpelExpressionParser.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Eat an identifier, possibly qualified (meaning that it is dotted).
 * TODO AndyC Could create complete identifiers (a.b.c) here rather than a sequence of them? (a, b, c)
 */
private SpelNodeImpl eatPossiblyQualifiedId() {
	LinkedList<SpelNodeImpl> qualifiedIdPieces = new LinkedList<SpelNodeImpl>();
	Token node = peekToken();
	while (isValidQualifiedId(node)) {
		nextToken();
		if (node.kind != TokenKind.DOT) {
			qualifiedIdPieces.add(new Identifier(node.stringValue(),toPos(node)));
		}
		node = peekToken();
	}
	if (qualifiedIdPieces.isEmpty()) {
		if (node == null) {
			raiseInternalException( this.expressionString.length(), SpelMessage.OOD);
		}
		raiseInternalException(node.startPos, SpelMessage.NOT_EXPECTED_TOKEN,
				"qualified ID", node.getKind().toString().toLowerCase());
	}
	int pos = toPos(qualifiedIdPieces.getFirst().getStartPosition(), qualifiedIdPieces.getLast().getEndPosition());
	return new QualifiedIdentifier(pos, qualifiedIdPieces.toArray(new SpelNodeImpl[qualifiedIdPieces.size()]));
}