Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [el-dev] Question about the new OptionalELResolver

On 08/02/2024 00:26, Paul Nicolucci via el-dev wrote:

I've been testing the OptionalELResolver added in: <>. The initially reported problem does look to be resolved. For example an expression of the form: "|domainObject.optionalProperty.requiredProperty|" works. However, I noticed that an expression trying to invoke a method on the class of optionalProperty does not work: |"domainObject.optionalProperty.someMethod()".|
|Was this the intention of the OptionalELResolver or was it an oversight that we should address?

Somewhere in the middle I think. The initial report was focused on properties and the current behavior - including method invocation - is as per the updated spec and Javadoc. That said, it makes sense to me to do something about this if we can.

We need to decide what the expected behavior is for method invocation.

When Optional.isPresent() is true this is easy. Call the method.

What about when Optional.isEmpty() is true? NO-OP? What if a return value is expected? null?


Back to the top