You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2025/01/08 15:07:00 UTC

[jira] [Commented] (CAMEL-19204) Generate component configurer case statements for Java 17

    [ https://issues.apache.org/jira/browse/CAMEL-19204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17911133#comment-17911133 ] 

Claus Ibsen commented on CAMEL-19204:
-------------------------------------

I dont think this improves much as java 17 style is also verbose, as you need to have blocks of code such as:
{code:java}
switch (ignoreCase ? name.toLowerCase() : name) {
    case "allowjavaserializedobject", "allowJavaSerializedObject" -> {
        target.setAllowJavaSerializedObject(property(camelContext, boolean.class, value));
        return true;
    }
    case "x", "y" -> {
        target.setAllowJavaSerializedObject(property(camelContext, boolean.class, value));
        return true;
    }
    default -> {
        return false;
    }
} {code}
 

Where the old code is just shorter
{code:java}
case "allowjavaserializedobject":
case "allowJavaSerializedObject": target.setAllowJavaSerializedObject(property(camelContext, boolean.class, value)); return true;
 {code}

> Generate component configurer case statements for Java 17
> ---------------------------------------------------------
>
>                 Key: CAMEL-19204
>                 URL: https://issues.apache.org/jira/browse/CAMEL-19204
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-package-maven-plugin
>            Reporter: Steve Storck
>            Priority: Minor
>             Fix For: 4.x
>
>         Attachments: PropertyConfigurerGenerator.java
>
>
> [~davsclaus] - here's a sort of proposal:
> Some minor edits to {{org.apache.camel.maven.packaging.PropertyConfigurerGenerator}} will generate the case statements in the Java 17 style.  I am proposing this, rather than simply doing it and submitting a pull request, because this affects a lot of things.  But, since Camel has moved to Java 17 for version 4, it might be good to update how generated code looks, so that it conforms to the more modern standard.  I also did a bit of code cleanup in the class which could also be kept or discarded, depending on what you think about it.
> I am attaching the modified class to this ticket.  Should this change be introduced?  Since it affects so much, is there a preferred way of doing this?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)