[
https://issues.apache.org/jira/browse/CAMEL-17918?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nicolas Filotto updated CAMEL-17918:
------------------------------------
Description:
When the headers class is an enum, so far the name of the headers can only be
the name of the values of the enum which is not enough in some particular use
cases. The idea of this improvement is to be able to provide the name of the
field or method to invoke in order to get the name of the corresponding header.
In the next example, if the enum "SomeEnum" is declared as the headers class of
a component, with the current code only "FOO" and "BAR" are possible values for
the name of the headers while here we would rather expect "fooKey" and "barKey".
{noformat}
public enum SomeEnum {
FOO("fooKey"),
BAR("barKey");
public final String headerName;
SomeEnum(final String str) {
this.headerName = str;
}
}{noformat}
was:
When the headers class is an enum, so far the name of the headers can only be
the name of the values of the enum which is not enough in some particular use
cases. The idea of this improvement is to be able to provide the name of the
field or method to invoke in order to get the name of the corresponding header.
In the next example, if the enum "SomeEnum" is declared as the headers class of
a component, with the current code only "FOO" and "BAR" are possible values for
the name of the headers while here we would rather expect "fooKey" and "barKey".
{noformat}
public enum SomeEnum {
FOO("fooKey"),
BAR("barKey");
public final String value;
SomeEnum(final String str) {
value = str;
}
}{noformat}
> Define the header name provider in case the headers class is an enum
> --------------------------------------------------------------------
>
> Key: CAMEL-17918
> URL: https://issues.apache.org/jira/browse/CAMEL-17918
> Project: Camel
> Issue Type: Improvement
> Reporter: Nicolas Filotto
> Assignee: Nicolas Filotto
> Priority: Minor
> Fix For: 3.17.0
>
>
> When the headers class is an enum, so far the name of the headers can only be
> the name of the values of the enum which is not enough in some particular use
> cases. The idea of this improvement is to be able to provide the name of the
> field or method to invoke in order to get the name of the corresponding
> header.
> In the next example, if the enum "SomeEnum" is declared as the headers class
> of a component, with the current code only "FOO" and "BAR" are possible
> values for the name of the headers while here we would rather expect "fooKey"
> and "barKey".
>
> {noformat}
> public enum SomeEnum {
> FOO("fooKey"),
> BAR("barKey");
> public final String headerName;
>
> SomeEnum(final String str) {
> this.headerName = str;
> }
> }{noformat}
>
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)