亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? proxygenerator.java

?? 一個java方面的消息訂閱發(fā)送的源碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/**
 * Redistribution and use of this software and associated documentation
 * ("Software"), with or without modification, are permitted provided
 * that the following conditions are met:
 *
 * 1. Redistributions of source code must retain copyright
 *    statements and notices.  Redistributions must also contain a
 *    copy of this document.
 *
 * 2. Redistributions in binary form must reproduce the
 *    above copyright notice, this list of conditions and the
 *    following disclaimer in the documentation and/or other
 *    materials provided with the distribution.
 *
 * 3. The name "Exolab" must not be used to endorse or promote
 *    products derived from this Software without prior written
 *    permission of Exoffice Technologies.  For written permission,
 *    please contact info@exolab.org.
 *
 * 4. Products derived from this Software may not be called "Exolab"
 *    nor may "Exolab" appear in their names without prior written
 *    permission of Exoffice Technologies. Exolab is a registered
 *    trademark of Exoffice Technologies.
 *
 * 5. Due credit should be given to the Exolab Project
 *    (http://www.exolab.org/).
 *
 * THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
 * EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright 2003-2005 (C) Exoffice Technologies Inc. All Rights Reserved.
 *
 * $Id: ProxyGenerator.java,v 1.6 2005/05/24 13:38:20 tanderson Exp $
 */
package org.exolab.jms.plugins.proxygen;

import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.lang.reflect.Method;
import java.rmi.RemoteException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;


/**
 * Generates source code for a <code>Proxy</code> implementation of a class.
 *
 * @author <a href="mailto:tma@netspace.net.au">Tim Anderson</a>
 * @version $Revision: 1.6 $ $Date: 2005/05/24 13:38:20 $
 */
public class ProxyGenerator {

    /**
     * The class to generate a proxy source for.
     */
    private final Class _clazz;

    /**
     * The package.
     */
    private final String _package;

    /**
     * The class name.
     */
    private final String _className;

    /**
     * A map of adapters of {@link Throwable}. The key is the target
     * exception type, the value the adapter class. The adapter class must
     * implement <code>ThrowableAdapter</code>. It is accessed via
     * introspection to avoid circular build dependencies.
     */
    private HashMap _adapters = new HashMap();

    /**
     * Interfaces implemented by the class.
     */
    private Class[] _interfaces;

    /**
     * The methods implemented by the class.
     */
    private Method[] _methods;

    /**
     * Primitive mappings.
     */
    private static final Class[][] MAPPINGS = new Class[][]{
        {boolean.class, Boolean.class},
        {byte.class, Byte.class},
        {short.class, Short.class},
        {char.class, Character.class},
        {int.class, Integer.class},
        {long.class, Long.class},
        {float.class, Float.class},
        {double.class, Double.class}};

    /**
     * The fully qualified Delegate class name.
     */
    private static final String DELEGATE = "org.exolab.jms.net.proxy.Delegate";

    /**
     * The fully qualified Proxy class name.
     */
    private static final String PROXY = "org.exolab.jms.net.proxy.Proxy";

    /**
     * The suffix for generated proxies.
     */
    private static final String PROXY_SUFFIX = "__Proxy";

    /**
     * The fully qualified RemoteInvocationException class name.
     */
    private static final String REMOTE_INVOCATION_EXCEPTION =
            "org.exolab.jms.net.proxy.RemoteInvocationException";

    /**
     * The fully qualified ThrowableAdapter class name.
     */
    private static final String THROWABLE_ADAPTER =
            "org.exolab.jms.net.proxy.ThrowableAdapter";


    /**
     * Construct a new <code>ProxyGenerator</code>.
     *
     * @param clazz   the class to generate proxy code for
     * @param adapters adapter classes for {@link RemoteException}. May be
     *                <code>null</code>
     * @throws Exception if <code>adapter</code> is specified but can't be
     *                   instantiated
     */
    public ProxyGenerator(Class clazz, Class[] adapters)
            throws Exception {
        if (clazz == null) {
            throw new IllegalArgumentException("Argument 'clazz' is null");
        }
        if (clazz.isArray()) {
            throw new IllegalArgumentException(
                    "Can't generate proxies for array types");
        }
        if (clazz.isPrimitive()) {
            throw new IllegalArgumentException(
                    "Can't generate proxies for primitive types");
        }
        _clazz = clazz;
        _package = ClassHelper.getPackage(_clazz);

        String name;
        if (_package != null) {
            name = _clazz.getName().substring(_package.length() + 1);
        } else {
            name = _clazz.getName();
        }
        _className = name + PROXY_SUFFIX;

        _interfaces = _clazz.getInterfaces();
        if (_interfaces.length == 0) {
            if (MethodHelper.getAllInterfaces(clazz).length == 0) {
                throw new IllegalArgumentException(
                        "Cannot generate proxy for class " + _clazz.getName()
                        + ": class doesn't implement any interfaces");
            }
        }

        if (adapters != null && adapters.length != 0) {
            _adapters = getAdapters(adapters);
        }

        _methods = MethodHelper.getInterfaceMethods(_clazz);
        Arrays.sort(_methods, new MethodComparator());
    }

    /**
     * Generates the code for the proxy implementation.
     *
     * @param stream the stream to write to
     * @throws IOException for any I/O error
     */
    public void generate(OutputStream stream) throws IOException {
        SourceWriter writer = new SourceWriter(new OutputStreamWriter(stream));

        if (_package != null) {
            writer.writeln("package " + _package + ";");
        }

        writer.writelnInc("public class " + _className);
        writer.writeln("extends " + getSuperclassProxy(_clazz));
        if (_interfaces.length != 0) {
            writer.write("implements ");
            for (int i = 0; i < _interfaces.length; ++i) {
                if (i > 0) {
                    writer.write(", ");
                }
                writer.write(_interfaces[i].getName());
            }
        }
        writer.writeln(" {");
        generateStaticDeclarations(writer);
        generateConstructor(writer);
        generateMethods(writer);
        generateStaticInitialiser(writer);
        writer.writelnDec();
        writer.writeln("}");
        writer.flush();
    }

    /**
     * Generates static declarations.
     *
     * @param writer the writer to write to
     * @throws IOException for any I/O error
     */
    protected void generateStaticDeclarations(SourceWriter writer)
            throws IOException {

        if (_methods.length > 0) {
            writer.writeln();
            for (int i = 0; i < _methods.length; ++i) {
                Method method = _methods[i];
                String name = getMethodVarName(method);
                writer.writeln("private static final java.lang.reflect.Method "
                               + name
                               + ";");
            }
            writer.writeln();

            Iterator iterator = _adapters.values().iterator();
            while (iterator.hasNext()) {
                Class adapter = (Class) iterator.next();
                String name = getAdapterInstanceName(adapter);
                writer.writeln("private static final "
                               + THROWABLE_ADAPTER + " " + name
                               + " = new " + adapter.getName()+ "();");
            }
            writer.writeln();
        }
    }

    /**
     * Generates the constructor.
     *
     * @param writer the writer to write to
     * @throws IOException for any I/O error
     */
    protected void generateConstructor(SourceWriter writer)
            throws IOException {

        writer.writelnInc("public " + _className + "(" + DELEGATE
                          + " delegate) {");
        writer.writelnDec("super(delegate);");
        writer.writeln("}");
    }

    /**
     * Generates the public methods.
     *
     * @param writer the writer to write to
     * @throws IOException for any I/O error
     */
    protected void generateMethods(SourceWriter writer) throws IOException {
        for (int i = 0; i < _methods.length; ++i) {
            writer.writeln();
            Method method = _methods[i];
            generateMethod(method, writer);
        }
    }

    /**
     * Generates a method.
     *
     * @param method the method to generate code for
     * @param writer the writer to write to
     * @throws IOException for any I/O error
     */
    protected void generateMethod(Method method, SourceWriter writer)
            throws IOException {

        Class returnType = method.getReturnType();
        Class[] argTypes = method.getParameterTypes();
        Class[] exceptionTypes = method.getExceptionTypes();
        boolean declaresThrowable = false;
        boolean declaresException = false;
        boolean declaresRuntimeException = false;
        boolean declaresRemoteException = false;
        boolean declaresRemoteInvocationException = false;
        boolean adaptThrowable = false;
        Class adaptType = null;

        for (int i = 0; i < exceptionTypes.length; ++i) {
            Class exceptionType = exceptionTypes[i];
            if (exceptionType.equals(Throwable.class)) {
                declaresThrowable = true;
            } else if (exceptionType.equals(Exception.class)) {
                declaresException = true;
            } else if (exceptionType.equals(RuntimeException.class)) {
                declaresRuntimeException = true;
            } else if (exceptionType.equals(RemoteException.class)) {
                declaresRemoteException = true;
            } else if (exceptionType.getName().equals(
                    REMOTE_INVOCATION_EXCEPTION)) {
                declaresRemoteInvocationException = true;
            } else if (_adapters.get(exceptionType) != null) {
                adaptType = exceptionType;
            }
        }

        if (!declaresThrowable && adaptType != null) {
            // rethrow all uncaught exceptions as an instance of adaptType
            adaptThrowable = true;
        }

        // determine the set of exceptions to catch.
        Class[] catchTypes = method.getExceptionTypes();
        Arrays.sort(catchTypes, new ClassComparator());

        // generate the method signature
        String returnClass = ClassHelper.getQualifiedName(returnType);
        writer.write("public " + returnClass + " " + method.getName() + "(");
        for (int i = 0; i < argTypes.length; ++i) {
            if (i > 0) {
                writer.write(", ");

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
www.日韩在线| 韩国精品主播一区二区在线观看| 东方aⅴ免费观看久久av| 亚洲精品一区二区三区福利 | 欧美色图激情小说| 亚洲午夜精品17c| 欧美日韩三级在线| 青青草精品视频| 久久婷婷色综合| 国产福利一区二区| 亚洲美女在线国产| 欧美日韩精品福利| 国内精品国产成人国产三级粉色| 国产亚洲欧洲997久久综合| 成人综合在线观看| 亚洲欧美偷拍卡通变态| 欧美午夜电影网| 久久成人免费电影| 中文字幕欧美一区| 69久久夜色精品国产69蝌蚪网| 九一久久久久久| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 狠狠色丁香久久婷婷综| 亚洲国产精品高清| 欧美影院精品一区| 国产麻豆成人传媒免费观看| 国产精品电影院| 欧美日韩国产美| 国产一区二区三区香蕉| 亚洲男女一区二区三区| 日韩一区二区三区在线视频| 成人一级黄色片| 午夜婷婷国产麻豆精品| 国产欧美视频一区二区| 欧美视频在线播放| 国产成人精品免费网站| 亚洲综合视频网| 欧美激情一区二区三区不卡| 色综合 综合色| 狠狠色丁香久久婷婷综| 亚洲专区一二三| 日本一区二区三区国色天香| 欧美绝品在线观看成人午夜影视| 国产一区二区毛片| 五月激情丁香一区二区三区| 国产精品美女久久久久高潮| 日韩免费性生活视频播放| 91香蕉视频黄| 丁香婷婷综合激情五月色| 五月婷婷综合网| 亚洲女人****多毛耸耸8| 精品国产亚洲在线| 欧美精品在线一区二区| 成人综合婷婷国产精品久久蜜臀| 青青草视频一区| 亚洲无线码一区二区三区| 中文av一区二区| 久久青草欧美一区二区三区| 91精品国产综合久久精品性色 | 水野朝阳av一区二区三区| 亚洲人xxxx| 欧美极品少妇xxxxⅹ高跟鞋| 日韩欧美在线影院| 欧美三电影在线| 在线看一区二区| 97精品久久久午夜一区二区三区| 国产精品18久久久久| 久久99国产乱子伦精品免费| 亚洲国产精品嫩草影院| 亚洲精品亚洲人成人网在线播放| 欧美激情一区二区在线| 国产欧美日韩精品a在线观看| 精品久久人人做人人爽| 日韩亚洲欧美成人一区| 5月丁香婷婷综合| 在线不卡中文字幕| 4438x成人网最大色成网站| 精品视频一区三区九区| 欧美私模裸体表演在线观看| 91成人在线精品| 欧美日本国产视频| 欧美丰满美乳xxx高潮www| 在线成人免费视频| 777色狠狠一区二区三区| 7777精品伊人久久久大香线蕉| 69堂成人精品免费视频| 91精品国产高清一区二区三区蜜臀| 欧美日韩国产综合一区二区| 欧美久久久久久久久中文字幕| 欧美丰满高潮xxxx喷水动漫| 日韩一区二区三区高清免费看看 | 蜜桃视频在线一区| 国产一区二区0| 成人黄色av电影| 91美女在线看| 欧美色涩在线第一页| 欧美群妇大交群中文字幕| 日韩一区和二区| 国产欧美日韩卡一| 一区二区三区在线视频免费| 亚洲国产成人tv| 久久国产婷婷国产香蕉| 国产乱码精品一品二品| 99精品国产99久久久久久白柏| 色综合天天在线| 制服丝袜激情欧洲亚洲| 久久久久久久久久久久久久久99 | 亚洲免费大片在线观看| 亚洲国产日日夜夜| 久久丁香综合五月国产三级网站| 国产精品456| 欧洲一区在线电影| 26uuu精品一区二区| 亚洲婷婷综合色高清在线| 婷婷国产v国产偷v亚洲高清| 国产在线视频一区二区| 99国产精品视频免费观看| 欧美精品自拍偷拍| 国产精品视频一二三| 三级精品在线观看| 丰满少妇在线播放bd日韩电影| 在线观看亚洲成人| 久久青草国产手机看片福利盒子 | 久久久久久久久久电影| 亚洲精品中文字幕在线观看| 精品亚洲成av人在线观看| 99re在线精品| 精品国产一区二区三区不卡| 日韩美女久久久| 精品亚洲欧美一区| 欧美日韩一级黄| 国产精品毛片a∨一区二区三区| 水蜜桃久久夜色精品一区的特点| 国产成人免费网站| 欧美精品18+| 亚洲欧美韩国综合色| 国产一区二区电影| 欧美猛男男办公室激情| 国产精品久久久久久久浪潮网站| 日韩黄色免费网站| 91成人免费在线| 中文字幕不卡在线播放| 看电视剧不卡顿的网站| 欧美性色aⅴ视频一区日韩精品| 国产天堂亚洲国产碰碰| 麻豆91在线播放免费| 欧美日韩免费一区二区三区| 最新热久久免费视频| 国产精品主播直播| 精品少妇一区二区三区在线播放| 亚洲午夜激情av| 色中色一区二区| 亚洲同性同志一二三专区| 国产精品一二三四| 26uuu国产在线精品一区二区| 午夜精品国产更新| 欧美日韩一区二区三区免费看| 亚洲色大成网站www久久九九| 成人三级在线视频| 久久精品人人做人人综合 | 久久久噜噜噜久噜久久综合| 天天综合色天天综合色h| 色婷婷综合久色| 日韩一区欧美小说| 97久久超碰国产精品| 亚洲婷婷综合色高清在线| av一区二区三区黑人| 国产精品久久夜| 99精品视频一区二区三区| 日韩毛片精品高清免费| 91在线精品秘密一区二区| 中文字幕一区二区三区在线播放| 成人99免费视频| 亚洲欧洲成人自拍| 色综合久久精品| 一区二区三区四区视频精品免费 | 亚洲女人****多毛耸耸8| 一本色道久久综合亚洲精品按摩| 一区二区中文字幕在线| 91麻豆福利精品推荐| 一二三四社区欧美黄| 欧美自拍偷拍一区| 亚洲成av人片在线观看无码| 欧美日韩成人一区| 麻豆精品一二三| 精品91自产拍在线观看一区| 国产精品99久| 亚洲欧美二区三区| 欧美色老头old∨ideo| 日韩激情一二三区| wwwwxxxxx欧美| av一区二区不卡| 亚洲成人免费在线观看| 日韩欧美高清在线| 成人国产精品免费观看视频| 亚洲欧美另类久久久精品| 6080yy午夜一二三区久久| 国产高清无密码一区二区三区| 亚洲欧美在线视频| 91精品国产色综合久久久蜜香臀|