fjtirado commented on code in PR #3278:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3278#discussion_r1384739704
##########
api/kogito-api/src/main/java/org/kie/kogito/internal/utils/ConversionUtils.java:
##########
@@ -114,9 +116,45 @@ private static Method getConvertMethod(Class<?> clazz) {
return null;
}
+ /**
+ * @return true if the given type corresponds to a java base type that has
the method valueOf(String value).
+ */
+ private static boolean isConvertibleFromStringJavaBaseType(Class<?> clazz)
{
+ return clazz == Short.class || clazz == Integer.class || clazz ==
Long.class ||
+ clazz == Float.class || clazz == Double.class ||
+ clazz == Boolean.class;
+ }
+
+ /**
+ * @return the value created by applying the static method valueOf(String)
on the given class. We use this method on
+ * these base java types to ensure conversion continues working on code
generated by the quarkus native build,
+ * since it was detected that valueOf is not discovered by reflection on
these classes after the native build.
+ */
+ private static <T> T convertFromStringJavaBaseType(Class<T> clazz, String
value) throws NumberFormatException {
+ if (clazz == Short.class) {
Review Comment:
Maybe for 100% completion we can add Byte class, wdyt?
The only case are strings between "0" and "255", but still a remove chance
of that hapenning.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]