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

Pasquale Congiusti commented on CAMEL-22910:
--------------------------------------------

Some experimental work was done in https://github.com/apache/camel/pull/21095

We may retake that work in the future if it makes sense. For now keeping this 
issue on hold.

> [camel-api] Exchange getPropertyAsList, getPropertyAsMap, ...
> -------------------------------------------------------------
>
>                 Key: CAMEL-22910
>                 URL: https://issues.apache.org/jira/browse/CAMEL-22910
>             Project: Camel
>          Issue Type: New Feature
>    Affects Versions: 4.x
>            Reporter: Pasquale Congiusti
>            Assignee: Pasquale Congiusti
>            Priority: Minor
>             Fix For: 4.x
>
>
> The exchange is often used to get properties or variable. The method 
> signature is like:
> {code}
> <T> T getProperty(String name, Class<T> type);
> {code}
> This is a bit of a runtime potential problem when, as a user, you want to 
> extract a Collection of elements as you need to enforce a rawtype. We can 
> work some additional method which are leveraging the existing implementation 
> to expose a new method like for example:
> {code}
> <T> Collection<T> getPropertyAsCollection(String name, Class<T> elementType)
> {code}
> which internally does all the checks to validate and return a coherent 
> Collection (and any other useful implementations we can think of), freeing 
> the user to cast to a raw type.



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

Reply via email to