From cdf170c568afa1303a87de05b8898dedb8634e5c Mon Sep 17 00:00:00 2001 From: hns <hannesw@gmail.com> Date: Mon, 1 Oct 2001 09:54:49 +0000 Subject: [PATCH] implemented isInstanceOf to tell whether a DbMapping represents itself or by inheritance some prototype. --- src/helma/objectmodel/db/DbMapping.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/helma/objectmodel/db/DbMapping.java b/src/helma/objectmodel/db/DbMapping.java index 58606d6e..590fdfd8 100644 --- a/src/helma/objectmodel/db/DbMapping.java +++ b/src/helma/objectmodel/db/DbMapping.java @@ -670,6 +670,21 @@ public class DbMapping implements Updatable { return !other.isRelational (); } + /** + * Return true if this db mapping represents the prototype indicated + * by the string argument, either itself or via one of its parent prototypes. + */ + public boolean isInstanceOf (String other) { + if (typename.equals (other)) + return true; + DbMapping p = parentMapping; + while (p != null) { + if (p.typename.equals (other)) + return true; + p = p.parentMapping; + } + return false; + } }