Java源码示例:org.springframework.expression.spel.ast.MethodReference

示例1
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;
}
 
示例2
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;
}
 
示例3
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;
}
 
示例4
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;
}