EOGenerator and numeric value types

0 views
Skip to first unread message

Mike Schrag

unread,
Mar 11, 2007, 7:55:45 PM3/11/07
to wot...@googlegroups.com
Previously, our eogenerator templates just had "Number" as the java class in the _Person.java superclasses.  If you want proper types, above any section that refers to <$Attribute.javaValueClassName$> you can put (this is really ugly, but it works; this may wrap, but it should all be on one line):

<$identify currentValueType = Attribute.javaValueClassName$><$if currentValueType == "Number"$><$if Attribute.valueType == 'B'$><$identify currentValueType = "BigDecimal"$><$else$><$if Attribute.valueType == 'i'$><$identify currentValueType = "Integer"$><$else$><$if Attribute.valueType == 'l'$><$identify currentValueType = "Long"$><$else$><$if Attribute.valueType == 'f'$><$identify currentValueType = "Float"$><$else$><$if Attribute.valueType == 'd'$><$identify currentValueType = "Double"$><$endif$><$endif$><$endif$><$endif$><$endif$><$endif$>

and then switch to refer to <$currentValueType$> instead of <$Attribute.javaValueClassName$>.  Anyone know if there is an <$else if$> construct in MiscMerge?  It wasn't apparent if there is, hence why this looks REALLY ugly.

But with this change, you'll get BigDecimal, Integer, Double, etc instead of just Number.

ms

Francis Labrie

unread,
Mar 12, 2007, 9:50:14 AM3/12/07
to wotips
Mike Schrag wrote:
> Previously, our eogenerator templates just had "Number" as the java
> class in the _Person.java superclasses. If you want proper types,
> above any section that refers to <$Attribute.javaValueClassName$> you
> can put (this is really ugly, but it works; this may wrap, but it
> should all be on one line):
>
> [...]

>
> and then switch to refer to <$currentValueType$> instead of <
> $Attribute.javaValueClassName$>. Anyone know if there is an <$else if
> $> construct in MiscMerge? It wasn't apparent if there is, hence why
> this looks REALLY ugly.
>
> But with this change, you'll get BigDecimal, Integer, Double, etc
> instead of just Number.

And if you use Byte and Short, you can get something uglier. But you
can also use this prettier one below:

<$
identify currentValueType = attribute.javaValueClassName$><$
if currentValueType == 'Number'$><$
if attribute.valueType == 'B'$><$
identify currentValueType = 'BigDecimal'$><$
elseif attribute.valueType == 'b'$><$
identify currentValueType = 'Byte'$><$
elseif attribute.valueType == 'd'$><$
identify currentValueType = 'Double'$><$
elseif attribute.valueType == 'f'$><$
identify currentValueType = 'Float'$><$
elseif attribute.valueType == 'i'$><$
identify currentValueType = 'Integer'$><$
elseif attribute.valueType == 'l'$><$
identify currentValueType = 'Long'$><$
elseif attribute.valueType == 's'$><$
identify currentValueType = 'Short'$><$
endif$><$
endif$>


Kind regards,

--
Francis Labrie

Mike Schrag

unread,
Mar 12, 2007, 10:15:02 AM3/12/07
to wot...@googlegroups.com
Nice -- Thanks Francis ... I hadn't thought of the indenting inside
the <$ .. $>. Makes that about 100x easier to read.

ms

Reply all
Reply to author
Forward
0 new messages