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

The following examples show how to use org.springframework.expression.spel.ast.TypeReference. 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 5 votes vote down vote up
private boolean maybeEatTypeReference() {
	if (peekToken(TokenKind.IDENTIFIER)) {
		Token typeName = peekToken();
		Assert.state(typeName != null, "Expected token");
		if (!"T".equals(typeName.stringValue())) {
			return false;
		}
		// It looks like a type reference but is T being used as a map key?
		Token t = takeToken();
		if (peekToken(TokenKind.RSQUARE)) {
			// looks like 'T]' (T is map key)
			push(new PropertyOrFieldReference(false, t.stringValue(), t.startPos, t.endPos));
			return true;
		}
		eatToken(TokenKind.LPAREN);
		SpelNodeImpl node = eatPossiblyQualifiedId();
		// dotted qualified id
		// Are there array dimensions?
		int dims = 0;
		while (peekToken(TokenKind.LSQUARE, true)) {
			eatToken(TokenKind.RSQUARE);
			dims++;
		}
		eatToken(TokenKind.RPAREN);
		this.constructedNodes.push(new TypeReference(typeName.startPos, typeName.endPos, node, dims));
		return true;
	}
	return false;
}
 
Example #2
Source File: InternalSpelExpressionParser.java    From java-technology-stack with MIT License 5 votes vote down vote up
private boolean maybeEatTypeReference() {
	if (peekToken(TokenKind.IDENTIFIER)) {
		Token typeName = peekToken();
		Assert.state(typeName != null, "Expected token");
		if (!"T".equals(typeName.stringValue())) {
			return false;
		}
		// It looks like a type reference but is T being used as a map key?
		Token t = takeToken();
		if (peekToken(TokenKind.RSQUARE)) {
			// looks like 'T]' (T is map key)
			push(new PropertyOrFieldReference(false, t.stringValue(), toPos(t)));
			return true;
		}
		eatToken(TokenKind.LPAREN);
		SpelNodeImpl node = eatPossiblyQualifiedId();
		// dotted qualified id
		// Are there array dimensions?
		int dims = 0;
		while (peekToken(TokenKind.LSQUARE, true)) {
			eatToken(TokenKind.RSQUARE);
			dims++;
		}
		eatToken(TokenKind.RPAREN);
		this.constructedNodes.push(new TypeReference(toPos(typeName), node, dims));
		return true;
	}
	return false;
}
 
Example #3
Source File: InternalSpelExpressionParser.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private boolean maybeEatTypeReference() {
	if (peekToken(TokenKind.IDENTIFIER)) {
		Token typeName = peekToken();
		if (!"T".equals(typeName.stringValue())) {
			return false;
		}
		// It looks like a type reference but is T being used as a map key?
		Token t = nextToken();
		if (peekToken(TokenKind.RSQUARE)) {
			// looks like 'T]' (T is map key)
			push(new PropertyOrFieldReference(false, t.data, toPos(t)));
			return true;
		}
		eatToken(TokenKind.LPAREN);
		SpelNodeImpl node = eatPossiblyQualifiedId();
		// dotted qualified id
		// Are there array dimensions?
		int dims = 0;
		while (peekToken(TokenKind.LSQUARE, true)) {
			eatToken(TokenKind.RSQUARE);
			dims++;
		}
		eatToken(TokenKind.RPAREN);
		this.constructedNodes.push(new TypeReference(toPos(typeName), node, dims));
		return true;
	}
	return false;
}
 
Example #4
Source File: InternalSpelExpressionParser.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private boolean maybeEatTypeReference() {
	if (peekToken(TokenKind.IDENTIFIER)) {
		Token typeName = peekToken();
		if (!typeName.stringValue().equals("T")) {
			return false;
		}
		// It looks like a type reference but is T being used as a map key?
		Token t = nextToken();
		if (peekToken(TokenKind.RSQUARE)) {
			// looks like 'T]' (T is map key)
			push(new PropertyOrFieldReference(false,t.data,toPos(t)));
			return true;
		}
		eatToken(TokenKind.LPAREN);
		SpelNodeImpl node = eatPossiblyQualifiedId();
		// dotted qualified id
		// Are there array dimensions?
		int dims = 0;
		while (peekToken(TokenKind.LSQUARE, true)) {
			eatToken(TokenKind.RSQUARE);
			dims++;
		}
		eatToken(TokenKind.RPAREN);
		this.constructedNodes.push(new TypeReference(toPos(typeName),node,dims));
		return true;
	}
	return false;
}