camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Does a "from Object" type converter override other converters?
Date Tue, 09 Oct 2012 14:31:30 GMT
On Tue, Oct 9, 2012 at 4:11 PM, Mark Doyle <> wrote:
> Hi all,
> Camel-mongodb has a set of provided type converters.
> @Converter
> public static DBObject fromStringToDBObject(String s) {
> ..blah blah
> }
> @Converter
> public static DBObject fromAnyObjectToDBObject(Object value) {
> ...blah blah
> }

This should be a @FallbackConverter instead. You should never convert
from Object -> XXX.
Instead it should be fallback and decided at runtime whether to convert or not.

> I'm trying to run a query which means sending a json string. After some
> debugging it looks like Camel selects the fromAnyObjectToDBObject converter
> rather than the fromStringToDBObject converter. I''m not sure of the
> consequences of this yet, with regards to the the mongodb component, but it
> did raise the question on how Camel deals with converters that could
> overlap given inheritance, a String is an Object after all.

Claus Ibsen
Red Hat, Inc.
FuseSource is now part of Red Hat
Twitter: davsclaus
Author of Camel in Action:

View raw message