From 95212f57e2f2ac0081427f897153b5d92a3de980 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 28 Apr 2009 06:27:04 +0000 Subject: [PATCH] Added as(). --- .../com/samskivert/depot/expression/ColumnExp.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/java/com/samskivert/depot/expression/ColumnExp.java b/src/java/com/samskivert/depot/expression/ColumnExp.java index 64a4fc6..762c876 100644 --- a/src/java/com/samskivert/depot/expression/ColumnExp.java +++ b/src/java/com/samskivert/depot/expression/ColumnExp.java @@ -51,6 +51,16 @@ public class ColumnExp this.name = field; } + /** + * Returns a column expression for the supplied persistent class with the same name as this + * expression. This is useful for "casting" a column expression from a parent class to a + * derived class. + */ + public ColumnExp as (Class oClass) + { + return new ColumnExp(oClass, name); + } + // from SQLExpression public Object accept (ExpressionVisitor builder) {