⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resultconverter.java

📁 用Java写的面相对象的数据库管理系统
💻 JAVA
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Core License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-2000 by SMB GmbH. All rights reserved.//// $Id: ResultConverter.java,v 1.11 2000/10/28 16:55:17 daniela Exp $package org.ozoneDB.core;import java.io.*;import java.util.*;import java.lang.reflect.*;import org.ozoneDB.*;/** * The base class for the classes that convert the parameter and results * of methods invocations that go through Database or ExternalDatabase. *  *  * @author <a href="http://www.softwarebuero.de/">SMB</a> * @version $Revision: 1.11 $Date: 2000/10/28 16:55:17 $ */public final class ResultConverter extends Object {            public static void updateProxyLinks( Object obj, OzoneInterface db ) throws Exception {        String name = obj != null ? obj.getClass().getName() : "(null)";        System.out.println( "*** Proxy test: " + name );                if (obj == null) {        //do nothing        } else if (obj instanceof OzoneProxy) {            ((OzoneProxy)obj).link = db;            System.out.println( "   *** link changed *** " + db );        } else {            Class cl = obj.getClass();            int mdf = cl.getModifiers();            if (Modifier.isTransient( mdf ) || Modifier.isStatic( mdf ) || Modifier.isFinal( mdf )) {            //do nothing            } else if (cl.isPrimitive()) {            //do nothing            } else if (cl.isArray()) {                int len = Array.getLength( obj );                for (int j = 0; j < len; j++) {                    Object member = Array.get( obj, j );                    updateProxyLinks( member, db );                }             } else {                Field[] fields = cl.getFields();                for (int i = 0; i < fields.length; i++) {                    // System.out.println (fields[i].toString());                    Object member = fields[i].get( obj );                    updateProxyLinks( member, db );                }             }         }     }             /**     * Substitute OzoneCompatible by a corresponding proxy. Do this recursive     * for all members.     */    public static Object substituteOzoneCompatibles( Object obj ) throws Exception {        //        String name = obj != null ? obj.getClass().getName() : "(null)";        //        System.out.println ("***OzoneCompatible test:" + name);                //FIXME: should be recursive        if (obj != null && obj instanceof OzoneCompatible) {            // System.out.println ("*** substitute ***");            return ((OzoneCompatible)obj).container().ozoneProxy();        // return (((OzoneCompatible)obj).objID()!=null) ? ((OzoneCompatible)obj).container().ozoneProxy() : obj;        }         return obj;    } }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -