mcarlett commented on code in PR #24451:
URL: https://github.com/apache/camel/pull/24451#discussion_r3528054591
##########
core/camel-support/src/main/java/org/apache/camel/support/component/PropertyConfigurerSupport.java:
##########
@@ -95,10 +98,24 @@ public static <T> T property(CamelContext camelContext,
Class<T> type, Object va
}
if (value != null) {
- try {
- if (MAGIC_VALUE.equals(value) && boolean.class == type) {
- value = "true";
+ if (MAGIC_VALUE.equals(value)) {
+ if (boolean.class == type || Boolean.class == type) {
+ return (T) Boolean.TRUE;
+ } else if (int.class == type || Integer.class == type) {
+ return (T) Integer.valueOf(1);
+ } else if (long.class == type || Long.class == type) {
+ return (T) Long.valueOf(1L);
+ } else if (double.class == type || Double.class == type) {
+ return (T) Double.valueOf(1d);
+ } else if (float.class == type || Float.class == type) {
+ return (T) Float.valueOf(1f);
+ } else if (short.class == type || Short.class == type) {
+ return (T) Short.valueOf((short) 1);
+ } else if (byte.class == type || Byte.class == type) {
+ return (T) Byte.valueOf((byte) 0);
}
+ }
Review Comment:
Done — added `Duration.class → Duration.ofMillis(1)` handling and removed
the duplicate MAGIC_VALUE code from both `ExportTypeConverter` and
`DummyTypeConverter`. Also added a `testMagicValueToDuration` test case.
--
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]