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 2022/03/17 16:01:32 UTC
[empire-db] branch master updated: EMPIREDB-385 simplification
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 3c24f8a EMPIREDB-385 simplification
3c24f8a is described below
commit 3c24f8a1fea69df60fdb792140c9aad6ef12e32c
Author: Rainer Döbele <do...@apache.org>
AuthorDate: Thu Mar 17 17:01:29 2022 +0100
EMPIREDB-385 simplification
---
empire-db/src/main/java/org/apache/empire/db/DBRecord.java | 10 +++-------
empire-db/src/main/java/org/apache/empire/db/DBRecordBean.java | 10 +++-------
2 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/empire-db/src/main/java/org/apache/empire/db/DBRecord.java b/empire-db/src/main/java/org/apache/empire/db/DBRecord.java
index 9b32cc0..d9ae732 100644
--- a/empire-db/src/main/java/org/apache/empire/db/DBRecord.java
+++ b/empire-db/src/main/java/org/apache/empire/db/DBRecord.java
@@ -293,16 +293,12 @@ public class DBRecord extends DBRecordBase
throw new InvalidArgumentException("id", id);
// convert to array
Object[] key;
- if (id instanceof Object[])
- { // Cast to array
+ if (id instanceof Object[]) {
+ // Cast to array
key = (Object[])id;
} else if (id instanceof Collection<?>) {
// Convert collection to array
- Collection<?> col = (Collection<?>)id;
- key = new Object[col.size()];
- int i=0;
- for (Object v : col)
- key[i++] = v;
+ key = ((Collection<?>)id).toArray();
} else {
// Single value
key = new Object[] { id };
diff --git a/empire-db/src/main/java/org/apache/empire/db/DBRecordBean.java b/empire-db/src/main/java/org/apache/empire/db/DBRecordBean.java
index 8c0ceb5..a593538 100644
--- a/empire-db/src/main/java/org/apache/empire/db/DBRecordBean.java
+++ b/empire-db/src/main/java/org/apache/empire/db/DBRecordBean.java
@@ -220,16 +220,12 @@ public class DBRecordBean extends DBRecordBase
throw new InvalidArgumentException("id", id);
// convert to array
Object[] key;
- if (id instanceof Object[])
- { // Cast to array
+ if (id instanceof Object[]) {
+ // Cast to array
key = (Object[])id;
} else if (id instanceof Collection<?>) {
// Convert collection to array
- Collection<?> col = (Collection<?>)id;
- key = new Object[col.size()];
- int i=0;
- for (Object v : col)
- key[i++] = v;
+ key = ((Collection<?>)id).toArray();
} else {
// Single value
key = new Object[] { id };