--- On Sat, 1/30/10, Adam Heath <[email protected]> wrote:
> From: Adam Heath <[email protected]>
> Subject: Re: svn commit: r904921 - in 
> /ofbiz/trunk/framework/base/src/org/ofbiz/base: test/BaseUnitTests.java 
> util/string/UelUtil.java
> To: [email protected]
> Date: Saturday, January 30, 2010, 5:28 PM
> Adrian Crum wrote:
> > --- On Sat, 1/30/10, Adam Heath <[email protected]>
> wrote:
> >> From: Adam Heath <[email protected]>
> >> Subject: Re: svn commit: r904921 - in
> /ofbiz/trunk/framework/base/src/org/ofbiz/base:
> test/BaseUnitTests.java util/string/UelUtil.java
> >> To: [email protected]
> >> Date: Saturday, January 30, 2010, 4:57 PM
> >> Adrian Crum wrote:
> >>>> If you really need to modify variable,
> then change
> >> the
> >>>> generics markup
> >>>> on context.
> >>> I appreciate the review and comments, but I
> think
> >> you're not understanding the integration. I can't
> change the
> >> method signature because it is part of the JSR
> 245
> >> specification, and yes, I really need to write to
> the
> >> context because that is the whole point of the
> integration.
> >>
> >> Well, then, the integration is wrong.  If
> that method
> >> signature is
> >> part of the spec, then you can't just go and do an
> end run
> >> around it
> >> because you feel like it.
> > 
> > The context Map that is passed around the framework
> (in services, mini-lang, and screen widgets) is referred to
> as Map<String, ? extends Object>. Yet some portions of
> the framework need to write to that Map - it's their job to
> do so. So, what do you suggest?
> 
> Dig further.  You'll find that this supposed read-only
> map is actually
> already a copy in places, so if you really do write to it,
> the changes
> will just be thrown away anyways.
> 
> In other cases, the original map that enters the system is
> already a
> throw-away.
> 
> When I originally came up with the read-only generics for
> service
> engine calls, I tried to make the maps writable.  But
> upon modifying
> the entire stack, I discovered it wasn't possible. 
> The service engine
> made copies in some cases, so the underlying service
> implementations
> weren't able to send data back at all to the original
> caller.  To
> encapsulate this, I made the map read only, by using the ?
> extends syntax.
> 
> What kind of modifications do you need to do? 
> Auto-vivification kinda
> stuff?

No, basic OFBiz kinda stuff.

<set field="var" value="Hello World!"/>

I need to set the var Map element to "Hello World!" The Map I'm being handed is 
read-only.

The nexus is FlexibleMapAccessor. Most of the framework uses it, and its 
purpose is to update a Map or a List. But it gets handed a read-only Map. I 
just pass the read-only Map on to the UEL stuff, and then convert it when I 
actually need to change something in it.




Reply via email to