You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Adam Heath <do...@brainfood.com> on 2010/02/19 21:49:34 UTC

FlexibleStringExpander api questions

What is getOriginal supposed to return?  The original string, or one
that has been fixed up and normalized?

What is toString supposed to return?  The same as getOriginal?  Or, a
fixed up version?  Ie, if there was a parse error, a missing trailing
'}', should toString add this missing character?

Basically, what is supposed to happen when parsing a badly formatted
string, ie, "The class for [${a}] is ${a.getClass()".

Additionally, ${bsh:} and ${groovy:} weren't returning the 'bsh' or
'groovy' part in original.

I've managed to remove some dead code; there were some places that
were testing for an empty parse string, but it was already tested for
in earlier methods.

In any event, I have 100% full coverage now in FSE, and it's test
cases.  I don't have coverage on any other helper classes in that
folder, including those that are called by FSE.

Re: FlexibleStringExpander api questions

Posted by Adrian Crum <ad...@yahoo.com>.
--- On Fri, 2/19/10, Adam Heath <do...@brainfood.com> wrote:
> What is getOriginal supposed to
> return?  The original string, or one
> that has been fixed up and normalized?

It is supposed to return the original string.

> What is toString supposed to return?  The same as
> getOriginal?

The same as getOriginal. I added that override recently as a convenience for debugging.

> if there was a parse error, a
> missing trailing
> '}', should toString add this missing character?

Wouldn't that be confusing or make it harder to debug bad expressions?

> Basically, what is supposed to happen when parsing a badly
> formatted
> string, ie, "The class for [${a}] is ${a.getClass()".

Throw an exception. In other words, force the programmer to fix it.

> Additionally, ${bsh:} and ${groovy:} weren't returning the
> 'bsh' or
> 'groovy' part in original.

Oops.

> I don't have coverage on any other helper
> classes in that
> folder, including those that are called by FSE.

I could help out with that. I might skip the UEL functions though - since  there are so many of them and most of them call java.* classes.

-Adrian