davsclaus commented on code in PR #28444:
URL: https://github.com/apache/camel/pull/28444#discussion_r4370713343
##########
core/camel-main/src/main/java/org/apache/camel/main/MainHelper.java:
##########
@@ -406,6 +417,37 @@ public static boolean setPropertiesOnTarget(
return rc;
}
+ /**
+ * The configurer of the data format or language that the option prefix,
such as camel.dataformat.jacksonXml. or
+ * camel.language.jsonpath., is about. They are found by their name
(jacksonXml-dataformat, jsonpath-language), as
+ * their name cannot always be told from their type.
+ *
+ * @param target the data format or language
+ * @return the configurer, or <tt>null</tt> for any other prefix,
when there is none, or when it is not the
Review Comment:
Done in 509f17359669: `{@code null}` instead of `<tt>null</tt>`.
_Claude Code on behalf of davsclaus_
##########
core/camel-main/src/main/java/org/apache/camel/main/MainHelper.java:
##########
@@ -406,6 +417,37 @@ public static boolean setPropertiesOnTarget(
return rc;
}
+ /**
+ * The configurer of the data format or language that the option prefix,
such as camel.dataformat.jacksonXml. or
+ * camel.language.jsonpath., is about. They are found by their name
(jacksonXml-dataformat, jsonpath-language), as
+ * their name cannot always be told from their type.
+ *
+ * @param target the data format or language
+ * @return the configurer, or <tt>null</tt> for any other prefix,
when there is none, or when it is not the
+ * configurer of the type of the target (such as a custom
bean with the name of a data format)
+ */
+ public static PropertyConfigurer configurerByName(CamelContext context,
String optionPrefix, Object target) {
+ String kind;
+ if (optionPrefix.startsWith("camel.dataformat.")) {
+ kind = "dataformat";
+ } else if (optionPrefix.startsWith("camel.language.")) {
+ kind = "language";
+ } else {
+ return null;
+ }
+ String name = StringHelper.between(optionPrefix, "camel." + kind +
".", ".");
+ if (name == null || name.isEmpty()) {
+ return null;
+ }
+ PropertyConfigurer configurer
+ =
PluginHelper.getConfigurerResolver(context).resolvePropertyConfigurer(name +
"-" + kind, context);
+ // the generated configurer of a type is named after it
+ if (configurer != null &&
configurer.getClass().getName().equals(target.getClass().getName() +
"Configurer")) {
Review Comment:
Done in 509f17359669: the comment now names the mojos,
`PackageDataFormatMojo` and `PackageLanguageMojo`, that generate the configurer
named after the type.
_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]