For ZeroArgumentNonVoidMethodPolicy, the hash square bracket syntax (e.g. 
obj["price"]) is not mentioned in its JavaDoc.
It's present in the release notes, which is how I discovered it.




On Sunday, 14 April 2024 at 12:43:50 BST, Daniel Dekany 
<daniel.dek...@gmail.com> wrote: 





There's no "EXPOSE" variant for that, at the moment. We had to add
something like EXPOSE_PROPERTIES_ONLY_EXCEPT_FOR_RECORDS_AND_VALUE_TYPES,
though with a less comical and more future-proof name.

On Sun, Apr 14, 2024 at 12:29 PM Simon Hartley
<scrhart...@yahoo.co.uk.invalid> wrote:
>
> I experimented with setting:
> exposureLevel=freemarker.ext.beans.BeansWrapper.EXPOSE_PROPERTIES_ONLY
>
> This seems to prevent records from using anything but the bean properties,
> so the components in the record don't get exposed as hash items.
> Is there some equivalent so that I could have beans act just as beans
> and records act just (more or less) as records (at least as a plan for the 
> future)?
> Or to filter out methods which don't conform to 
> ZeroArgumentNonVoidMethodPolicy (plus indexed methods)?
>
> Cheers,
> Simon
>
>
>
>
> On Thursday, 11 April 2024 at 09:42:02 BST, Daniel Dekany 
> <daniel.dek...@gmail.com> wrote:
>
>
>
>
>
> > So what I plant to do is renaming things to something like these
> > (suggestion for better names are welcome):
> >
> > ZeroArgumentNonVoidMethodPolicy.BEAN_AWARE_THEN_EXPOSE_AS_METHOD
> > ZeroArgumentNonVoidMethodPolicy.BEAN_AWARE_THEN_EXPOSE_AS_PROPERTY
> > ZeroArgumentNonVoidMethodPolicy.BEAN_AWARE_THEN_EXPOSE_AS_PROPERTY_AND_METHOD
> >
> > And then maybe I would also add policies where we don't care about
> > bean stuff, as it should be in theory with records. I don't think many
> > user will want such a purist approach, but it can be useful in
> > ensuring that our implementation is sound (because then it should be
> > possible to implement such a policy).



-- 
Best regards,

Daniel Dekany

Reply via email to