davsclaus commented on code in PR #30338:
URL: https://github.com/apache/camel/pull/30338#discussion_r4620072347
##########
core/camel-support/src/main/java/org/apache/camel/support/PropertyConfigurerHelper.java:
##########
@@ -103,6 +108,75 @@ public static PropertyConfigurer
resolvePropertyConfigurer(CamelContext context,
return null;
}
+ /**
+ * Resolves the configurer of a component, data format or language by its
name (such as jackson-dataformat), and
+ * makes sure it is the configurer of the given target.
+ * <p>
+ * Two JARs can register a configurer with the same name, and then the one
first on the classpath is found. For
+ * example both camel-jackson (Jackson 2.x) and camel-jackson3 (Jackson
3.x) register jackson-dataformat, while the
+ * jackson data format is created from camel-jackson3 when both are on the
classpath. When the configurer found by
+ * name is generated for another type than the target, the configurer
generated for the type of the target is used
+ * instead.
+ *
+ * @param context the camel context
+ * @param name the name of the configurer, such as jackson-dataformat
+ * @param target the component, data format or language to configure, or
<code>null</code> to only resolve the
+ * configurer by its name
+ * @return the resolved configurer, or <code>null</code> if no
configurer could be found
+ */
+ public static PropertyConfigurer
resolvePropertyConfigurerByName(CamelContext context, String name, Object
target) {
Review Comment:
Added `PropertyConfigurerHelperByNameTest` in camel-core in b4c665c494b0. A
configurer resolver returns a configurer generated for another type under one
name, and the test covers the fallback to the target's own configurer (also
through `resolvePropertyConfigurer(context, Class)`), a target with no
generated configurer (the configurer found by name is kept), a subclass target
(the parent's configurer is kept, and is the fallback), a configurer that is
not generated, and a lookup without a target. The description now also says
that the class to name mapping covers components and languages.
_Claude Code on behalf of davsclaus_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]