Class PropertyOrFieldReference

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

public class PropertyOrFieldReference extends SpelNodeImpl
Represents a simple public property or field reference.

Null-safe Navigation

Null-safe navigation is supported via the '?.' operator. For example, 'user?.name' will evaluate to null if user is null and will otherwise evaluate to the name of the user. As of Spring Framework 7.0, null-safe navigation also applies when accessing a property or field on an Optional target. For example, if user is of type Optional<User>, the expression 'user?.name' will evaluate to null if user is null or empty and will otherwise evaluate to the name of the user, effectively user.get().getName() or user.get().name.

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