You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2021/10/30 11:05:29 UTC
[empire-db] branch master updated: EMPIREDB-354 Allow object value
conversion to enum in ObjectUtils.convert()
This is an automated email from the ASF dual-hosted git repository.
doebele pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/empire-db.git
The following commit(s) were added to refs/heads/master by this push:
new 5b34b93 EMPIREDB-354 Allow object value conversion to enum in ObjectUtils.convert()
5b34b93 is described below
commit 5b34b9356aa7d694e51545840db4096b48e370fd
Author: Rainer Döbele <do...@apache.org>
AuthorDate: Sat Oct 30 13:05:26 2021 +0200
EMPIREDB-354
Allow object value conversion to enum in ObjectUtils.convert()
---
empire-db/src/main/java/org/apache/empire/commons/ObjectUtils.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/empire-db/src/main/java/org/apache/empire/commons/ObjectUtils.java b/empire-db/src/main/java/org/apache/empire/commons/ObjectUtils.java
index 810b1b3..d85afa5 100644
--- a/empire-db/src/main/java/org/apache/empire/commons/ObjectUtils.java
+++ b/empire-db/src/main/java/org/apache/empire/commons/ObjectUtils.java
@@ -734,6 +734,11 @@ public final class ObjectUtils
c = (Class<T>) MethodUtils.getPrimitiveWrapper(c);
}
// Convert
+ if (c.isEnum())
+ { // convert to enum
+ Object ev = getEnum((Class<? extends Enum<?>>)c, v);
+ return (T)ev;
+ }
if (c.isAssignableFrom(Boolean.class))
return c.cast(getBoolean(v));
if (c.isAssignableFrom(Integer.class))