In Apache CamelΒ we use “simple” statement to extract values in a pojo.
For example if we have a pojo “Employee” having “employeeId” as one of the attribute,Β and employee object is available in camel exchange body, we can retrieve the employee id with following statement.
simple("${body.employeeId}");
If by chance body is null above statement will throw null pointer exception. Apache Camel provides a solution to avoid this situation. Β Use ?. instead of . to access attributes.
simple("${body?.employeeId}");
Is the value of “${body?.employeeId}” is null if there is no employeeId property?
Yes. Value will be “null” if object in body doesn’t have “employeeId” attribute.