On Fri, Feb 6, 2009 at 13:32, Ulrich Stärk <u...@spielviel.de> wrote:
> Does it work when you move the Unit enum into it's own class file?

No, it doesn't. But I now know why: There are two different Unit
classes from different ClassLoaders. So, I moved Unit out of
Tapestry's app-package and now it works!

Since I really like to have my Unit enum in the Size component what
can I do to keep Tapestry from using different ClassLoaders?

Regards,
Folke


> Uli
>
> Folke Behrens schrieb:
>>
>> Hi
>>
>> Type coercion from String to an Enum type doesn't seem work. I get an
>> IllegalArgumentException even though I wrote a special TypeCoercer and
>> hooked it in via module.
>>
>>  public static void
>> contributeTypeCoercer(Configuration<CoercionTuple<String,Size.Unit>>
>> configuration) {
>>    configuration.add(new
>> CoercionTuple<String,Size.Unit>(String.class, Size.Unit.class, new
>> Coercion<String,Size.Unit>() {
>>      public Size.Unit coerce(String input) {
>>        return Enum.valueOf(Size.Unit.class, input);
>>      }
>>    }));
>>  }
>>
>>
>> java.lang.IllegalArgumentException
>> Could not find a coercion from type java.lang.String to type
>> com.example.server.web.components.Size$Unit. Available coercions:
>> [...] String --> com.example.server.web.components.Size$Unit [...]
>>
>> Stack trace
>>        *
>> org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl.findOrCreateCoercion(TypeCoercerImpl.java:245)
>>        [...]
>>        *
>> com.example.server.web.components.Size._$read_parameter_unit(Size.java)
>>
>> Is it possible that Class.isAssignableFrom() does not work for Enum
>> types? (see TypeCoercerImpl:231)
>>
>> There's already an issue report
>> (https://issues.apache.org/jira/browse/TAP5-98) where the reporter
>> indicates that this should work. Would did I do wrong?
>>
>> Regards,
>> Folke
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to