Class MethodReference

java.lang.Object
org.springframework.expression.spel.ast.SpelNodeImpl
org.springframework.expression.spel.ast.MethodReference
All Implemented Interfaces:
Opcodes, SpelNode

public class MethodReference extends SpelNodeImpl
Expression language AST node that represents a method reference (i.e., a method invocation other than a simple property reference).

Null-safe Invocation

Null-safe invocation is supported via the '?.' operator. For example, 'counter?.incrementBy(1)' will evaluate to null if counter is null and will otherwise evaluate to the value returned from the invocation of counter.incrementBy(1). As of Spring Framework 7.0, null-safe invocation also applies when invoking a method on an Optional target. For example, if counter is of type Optional<Counter>, the expression 'counter?.incrementBy(1)' will evaluate to null if counter is null or empty and will otherwise evaluate the value returned from the invocation of counter.get().incrementBy(1).

Since:
3.0
Author:
Andy Clement, Juergen Hoeller, Sam Brannen