From a28231755a4343f12ffbf7771998af337512bdb3 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 20 Oct 2006 23:49:41 +0000 Subject: [PATCH] Key convience constructors from Zell. --- src/java/com/samskivert/jdbc/depot/Key.java | 29 +++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/java/com/samskivert/jdbc/depot/Key.java b/src/java/com/samskivert/jdbc/depot/Key.java index 17769cb..52b35a8 100644 --- a/src/java/com/samskivert/jdbc/depot/Key.java +++ b/src/java/com/samskivert/jdbc/depot/Key.java @@ -3,7 +3,7 @@ // // samskivert library - useful routines for java programs // Copyright (C) 2006 Michael Bayne -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or @@ -43,7 +43,7 @@ public class Key public Key (String index, Comparable value) { - this(new ColumnExpression(null, index), value); + this(new ColumnExpression(index), value); } public Key (ColumnExpression column, Comparable value) @@ -53,17 +53,36 @@ public class Key public Key (String index1, Comparable value1, String index2, Comparable value2) { - this(new ColumnExpression[] { new ColumnExpression(null, index1), - new ColumnExpression(null, index2) }, + this(new ColumnExpression[] { new ColumnExpression(index1), + new ColumnExpression(index2) }, new Comparable[] { value1, value2 }); } + public Key (String index1, Comparable value1, String index2, Comparable value2, + String index3, Comparable value3) + { + this(new ColumnExpression[] { new ColumnExpression(index1), + new ColumnExpression(index2), + new ColumnExpression(index3) }, + new Comparable[] { value1, value2, value3 }); + } + + public Key (String[] columns, Comparable[] values) + { + ColumnExpression[] colExp = new ColumnExpression[columns.length]; + for (int ii = 0; ii < columns.length; ii ++) { + colExp[ii] = new ColumnExpression(columns[ii]); + } + this.columns = colExp; + this.values = values; + } + public Key (ColumnExpression[] columns, Comparable[] values) { this.columns = columns; this.values = values; } - + public List getClassSet() { return Arrays.asList(new Class[] { }); }