velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew Van Horn" <matt...@ashleyassociates.co.jp>
Subject Class cast issue?
Date Tue, 03 Aug 2004 10:09:48 GMT
I have a typesafe enum class with methods:

    public final Serializable getEnumCode() {
        return enumCode;
    }

    public String toString() {
        return name;
    }

I put a number of these objects into a SortedSet, and in my template I
try:

#foreach($obj in $objSet)
<option value="$obj.enumCode">$obj</option>
#end

This outputs:

<option value="$obj.enumCode">Foo</option>
<option value="$obj.enumCode">Bar</option>
<option value="$obj.enumCode">Baz</option>

I have tried :
<option value="$obj.getEnumCode()">
And
<option value="$obj.getEnumCode().toString()">

But none of them seem to return a value.

Does it have anything to do with the fact that the method returns
Serializable? How can I get it to do the obvious?

Thanks,
Matt


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message