org.springframework.expression.spel.ast.PropertyOrFieldReference Java Examples
The following examples show how to use
org.springframework.expression.spel.ast.PropertyOrFieldReference.
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 |
private boolean maybeEatMethodOrProperty(boolean nullSafeNavigation) { if (peekToken(TokenKind.IDENTIFIER)) { Token methodOrPropertyName = takeToken(); SpelNodeImpl[] args = maybeEatMethodArgs(); if (args == null) { // property push(new PropertyOrFieldReference(nullSafeNavigation, methodOrPropertyName.stringValue(), methodOrPropertyName.startPos, methodOrPropertyName.endPos)); return true; } // method reference push(new MethodReference(nullSafeNavigation, methodOrPropertyName.stringValue(), methodOrPropertyName.startPos, methodOrPropertyName.endPos, args)); // TODO what is the end position for a method reference? the name or the last arg? return true; } return false; }
Example #2
Source File: InternalSpelExpressionParser.java From java-technology-stack with MIT License | 6 votes |
private boolean maybeEatMethodOrProperty(boolean nullSafeNavigation) { if (peekToken(TokenKind.IDENTIFIER)) { Token methodOrPropertyName = takeToken(); SpelNodeImpl[] args = maybeEatMethodArgs(); if (args == null) { // property push(new PropertyOrFieldReference(nullSafeNavigation, methodOrPropertyName.stringValue(), toPos(methodOrPropertyName))); return true; } // method reference push(new MethodReference(nullSafeNavigation, methodOrPropertyName.stringValue(), toPos(methodOrPropertyName), args)); // TODO what is the end position for a method reference? the name or the last arg? return true; } return false; }
Example #3
Source File: InternalSpelExpressionParser.java From lams with GNU General Public License v2.0 | 6 votes |
private boolean maybeEatMethodOrProperty(boolean nullSafeNavigation) { if (peekToken(TokenKind.IDENTIFIER)) { Token methodOrPropertyName = nextToken(); SpelNodeImpl[] args = maybeEatMethodArgs(); if (args == null) { // property push(new PropertyOrFieldReference(nullSafeNavigation, methodOrPropertyName.data, toPos(methodOrPropertyName))); return true; } // method reference push(new MethodReference(nullSafeNavigation, methodOrPropertyName.data, toPos(methodOrPropertyName), args)); // TODO what is the end position for a method reference? the name or the last arg? return true; } return false; }
Example #4
Source File: InternalSpelExpressionParser.java From spring4-understanding with Apache License 2.0 | 6 votes |
private boolean maybeEatMethodOrProperty(boolean nullSafeNavigation) { if (peekToken(TokenKind.IDENTIFIER)) { Token methodOrPropertyName = nextToken(); SpelNodeImpl[] args = maybeEatMethodArgs(); if (args==null) { // property push(new PropertyOrFieldReference(nullSafeNavigation, methodOrPropertyName.data,toPos(methodOrPropertyName))); return true; } // methodreference push(new MethodReference(nullSafeNavigation, methodOrPropertyName.data, toPos(methodOrPropertyName), args)); // TODO what is the end position for a method reference? the name or the last arg? return true; } return false; }
Example #5
Source File: InternalSpelExpressionParser.java From spring-analysis-note with MIT License | 5 votes |
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 #6
Source File: InternalSpelExpressionParser.java From spring-analysis-note with MIT License | 5 votes |
private boolean maybeEatConstructorReference() { if (peekIdentifierToken("new")) { Token newToken = takeToken(); // It looks like a constructor reference but is NEW being used as a map key? if (peekToken(TokenKind.RSQUARE)) { // looks like 'NEW]' (so NEW used as map key) push(new PropertyOrFieldReference(false, newToken.stringValue(), newToken.startPos, newToken.endPos)); return true; } SpelNodeImpl possiblyQualifiedConstructorName = eatPossiblyQualifiedId(); List<SpelNodeImpl> nodes = new ArrayList<>(); nodes.add(possiblyQualifiedConstructorName); if (peekToken(TokenKind.LSQUARE)) { // array initializer List<SpelNodeImpl> dimensions = new ArrayList<>(); while (peekToken(TokenKind.LSQUARE, true)) { if (!peekToken(TokenKind.RSQUARE)) { dimensions.add(eatExpression()); } else { dimensions.add(null); } eatToken(TokenKind.RSQUARE); } if (maybeEatInlineListOrMap()) { nodes.add(pop()); } push(new ConstructorReference(newToken.startPos, newToken.endPos, dimensions.toArray(new SpelNodeImpl[0]), nodes.toArray(new SpelNodeImpl[0]))); } else { // regular constructor invocation eatConstructorArgs(nodes); // TODO correct end position? push(new ConstructorReference(newToken.startPos, newToken.endPos, nodes.toArray(new SpelNodeImpl[0]))); } return true; } return false; }
Example #7
Source File: InternalSpelExpressionParser.java From java-technology-stack with MIT License | 5 votes |
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 #8
Source File: InternalSpelExpressionParser.java From java-technology-stack with MIT License | 5 votes |
private boolean maybeEatConstructorReference() { if (peekIdentifierToken("new")) { Token newToken = takeToken(); // It looks like a constructor reference but is NEW being used as a map key? if (peekToken(TokenKind.RSQUARE)) { // looks like 'NEW]' (so NEW used as map key) push(new PropertyOrFieldReference(false, newToken.stringValue(), toPos(newToken))); return true; } SpelNodeImpl possiblyQualifiedConstructorName = eatPossiblyQualifiedId(); List<SpelNodeImpl> nodes = new ArrayList<>(); nodes.add(possiblyQualifiedConstructorName); if (peekToken(TokenKind.LSQUARE)) { // array initializer List<SpelNodeImpl> dimensions = new ArrayList<>(); while (peekToken(TokenKind.LSQUARE, true)) { if (!peekToken(TokenKind.RSQUARE)) { dimensions.add(eatExpression()); } else { dimensions.add(null); } eatToken(TokenKind.RSQUARE); } if (maybeEatInlineListOrMap()) { nodes.add(pop()); } push(new ConstructorReference(toPos(newToken), dimensions.toArray(new SpelNodeImpl[0]), nodes.toArray(new SpelNodeImpl[0]))); } else { // regular constructor invocation eatConstructorArgs(nodes); // TODO correct end position? push(new ConstructorReference(toPos(newToken), nodes.toArray(new SpelNodeImpl[0]))); } return true; } return false; }
Example #9
Source File: InternalSpelExpressionParser.java From lams with GNU General Public License v2.0 | 5 votes |
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 #10
Source File: InternalSpelExpressionParser.java From spring4-understanding with Apache License 2.0 | 5 votes |
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; }
Example #11
Source File: InternalSpelExpressionParser.java From lams with GNU General Public License v2.0 | 4 votes |
private boolean maybeEatConstructorReference() { if (peekIdentifierToken("new")) { Token newToken = nextToken(); // It looks like a constructor reference but is NEW being used as a map key? if (peekToken(TokenKind.RSQUARE)) { // looks like 'NEW]' (so NEW used as map key) push(new PropertyOrFieldReference(false, newToken.data, toPos(newToken))); return true; } SpelNodeImpl possiblyQualifiedConstructorName = eatPossiblyQualifiedId(); List<SpelNodeImpl> nodes = new ArrayList<SpelNodeImpl>(); nodes.add(possiblyQualifiedConstructorName); if (peekToken(TokenKind.LSQUARE)) { // array initializer List<SpelNodeImpl> dimensions = new ArrayList<SpelNodeImpl>(); while (peekToken(TokenKind.LSQUARE, true)) { if (!peekToken(TokenKind.RSQUARE)) { dimensions.add(eatExpression()); } else { dimensions.add(null); } eatToken(TokenKind.RSQUARE); } if (maybeEatInlineListOrMap()) { nodes.add(pop()); } push(new ConstructorReference(toPos(newToken), dimensions.toArray(new SpelNodeImpl[dimensions.size()]), nodes.toArray(new SpelNodeImpl[nodes.size()]))); } else { // regular constructor invocation eatConstructorArgs(nodes); // TODO correct end position? push(new ConstructorReference(toPos(newToken), nodes.toArray(new SpelNodeImpl[nodes.size()]))); } return true; } return false; }
Example #12
Source File: InternalSpelExpressionParser.java From spring4-understanding with Apache License 2.0 | 4 votes |
private boolean maybeEatConstructorReference() { if (peekIdentifierToken("new")) { Token newToken = nextToken(); // It looks like a constructor reference but is NEW being used as a map key? if (peekToken(TokenKind.RSQUARE)) { // looks like 'NEW]' (so NEW used as map key) push(new PropertyOrFieldReference(false,newToken.data,toPos(newToken))); return true; } SpelNodeImpl possiblyQualifiedConstructorName = eatPossiblyQualifiedId(); List<SpelNodeImpl> nodes = new ArrayList<SpelNodeImpl>(); nodes.add(possiblyQualifiedConstructorName); if (peekToken(TokenKind.LSQUARE)) { // array initializer List<SpelNodeImpl> dimensions = new ArrayList<SpelNodeImpl>(); while (peekToken(TokenKind.LSQUARE,true)) { if (!peekToken(TokenKind.RSQUARE)) { dimensions.add(eatExpression()); } else { dimensions.add(null); } eatToken(TokenKind.RSQUARE); } if (maybeEatInlineListOrMap()) { nodes.add(pop()); } push(new ConstructorReference(toPos(newToken), dimensions.toArray(new SpelNodeImpl[dimensions.size()]), nodes.toArray(new SpelNodeImpl[nodes.size()]))); } else { // regular constructor invocation eatConstructorArgs(nodes); // TODO correct end position? push(new ConstructorReference(toPos(newToken), nodes.toArray(new SpelNodeImpl[nodes.size()]))); } return true; } return false; }