Align to ReflectivePropertyAccessor

Comment From: snicoll

Before we can consider this PR, we'd need to understand the use case. You are talking about alignment but I don't see that as necessary (or inconsistent at the moment). Also, please refrain from doing unrelated changes. All those formatting in the tests should go away.

Comment From: quaff

Before we can consider this PR, we'd need to understand the use case.

I need EvaluationContext like SimpleEvaluationContext.forReadOnlyDataBinding() plus MapAccessor.

Also, please refrain from doing unrelated changes. All those formatting in the tests should go away.

OK, I will revert those changes.

Comment From: sbrannen

Hi @quaff,

I need EvaluationContext like SimpleEvaluationContext.forReadOnlyDataBinding() plus MapAccessor.

In order to achieve your goal, you'll actually need to make use of withAssignmentDisabled() as well -- for example, something like the following.

SimpleEvaluationContext context = SimpleEvaluationContext
        .forPropertyAccessors(new MapAccessor(false), DataBindingPropertyAccessor.forReadOnlyAccess())
        .withAssignmentDisabled()
        .build();
  • see #33319

Comment From: quaff

Thanks for your caution.