當前位置: 首頁>>代碼示例>>Java>>正文


Java ClassDoc.subclassOf方法代碼示例

本文整理匯總了Java中com.sun.javadoc.ClassDoc.subclassOf方法的典型用法代碼示例。如果您正苦於以下問題:Java ClassDoc.subclassOf方法的具體用法?Java ClassDoc.subclassOf怎麽用?Java ClassDoc.subclassOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sun.javadoc.ClassDoc的用法示例。


在下文中一共展示了ClassDoc.subclassOf方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: collectCompatibleExceptions

import com.sun.javadoc.ClassDoc; //導入方法依賴的package包/類
/**
 * Adds to the supplied list all exceptions in the "froms"
 * array that are subclasses of an exception in the "withs"
 * array.
 **/
private void collectCompatibleExceptions(ClassDoc[] froms,
                                         ClassDoc[] withs,
                                         List<ClassDoc> list)
{
    for (ClassDoc from : froms) {
        if (!list.contains(from)) {
            for (ClassDoc with : withs) {
                if (from.subclassOf(with)) {
                    list.add(from);
                    break;
                }
            }
        }
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:21,代碼來源:RemoteClass.java

示例2: computeUniqueCatchList

import com.sun.javadoc.ClassDoc; //導入方法依賴的package包/類
/**
 * Computes the exceptions that need to be caught and rethrown in
 * a stub method before wrapping Exceptions in
 * UnexpectedExceptions, given the exceptions declared in the
 * throws clause of the method.  Returns a list containing the
 * exception to catch.  Each exception is guaranteed to be unique,
 * i.e. not a subclass of any of the other exceptions in the list,
 * so the catch blocks for these exceptions may be generated in
 * any order relative to each other.
 *
 * RemoteException and RuntimeException are each automatically
 * placed in the returned list (unless any of their superclasses
 * are already present), since those exceptions should always be
 * directly rethrown by a stub method.
 *
 * The returned list will be empty if java.lang.Exception or one
 * of its superclasses is in the throws clause of the method,
 * indicating that no exceptions need to be caught.
 **/
private List<ClassDoc> computeUniqueCatchList(ClassDoc[] exceptions) {
    List<ClassDoc> uniqueList = new ArrayList<ClassDoc>();

    uniqueList.add(env.docRuntimeException());
    uniqueList.add(env.docRemoteException()); // always catch/rethrow these

    /* For each exception declared by the stub method's throws clause: */
nextException:
    for (ClassDoc ex : exceptions) {
        if (env.docException().subclassOf(ex)) {
            /*
             * If java.lang.Exception (or a superclass) was declared
             * in the throws clause of this stub method, then we don't
             * have to bother catching anything; clear the list and
             * return.
             */
            uniqueList.clear();
            break;
        } else if (!ex.subclassOf(env.docException())) {
            /*
             * Ignore other Throwables that do not extend Exception,
             * because they cannot be thrown by the invoke methods.
             */
            continue;
        }
        /*
         * Compare this exception against the current list of
         * exceptions that need to be caught:
         */
        for (Iterator<ClassDoc> i = uniqueList.iterator(); i.hasNext();) {
            ClassDoc ex2 = i.next();
            if (ex.subclassOf(ex2)) {
                /*
                 * If a superclass of this exception is already on
                 * the list to catch, then ignore this one and continue;
                 */
                continue nextException;
            } else if (ex2.subclassOf(ex)) {
                /*
                 * If a subclass of this exception is on the list
                 * to catch, then remove it;
                 */
                i.remove();
            }
        }
        /* This exception is unique: add it to the list to catch. */
        uniqueList.add(ex);
    }
    return uniqueList;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:70,代碼來源:StubSkeletonWriter.java


注:本文中的com.sun.javadoc.ClassDoc.subclassOf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。