在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Java/ Class<? extends SendDataJob> clszz

Class<? extends SendDataJob> clszz 這個參數(shù)怎么理解?反射類還是什么?

public void starSendDataJob(Class<? extends SendDataJob> clszz,int intervalMin,String topcic){
        try {
            JobDetail senddatajobDetail = JobBuilder.newJob(clszz)
                    .withIdentity(new JobKey(clszz.getSimpleName(), collectorJobGroup)).storeDurably().build();
            senddatajobDetail.getJobDataMap().put("topic", topcic);
            scheduler.addJob(senddatajobDetail, true);
            addTrigger(clszz.getSimpleName(),senddatajobDetail, intervalMin);
        } catch (SchedulerException e) {
            log.error("start send data job error,jobname:{}",clszz.getName());
            log.error("start send data job error",e);
            e.printStackTrace();
        }
    }
回答
編輯回答
愛是癌

Class對象,就是類的元信息對象,保存一個類的字段,方法等等元信息。
<? extends SendDataJob> 泛型,說明clazz對象是SendDataJob子類的類對象。

2017年6月16日 22:47
編輯回答
卟乖

知識點:泛型,字節(jié)碼,反射

2017年3月3日 08:23
編輯回答
陌離殤

還能怎么理解呢,就是表示在運行時表示這個對象的類。
Java萬物基于Object。
請看Object里面的getClass方法。

/**
     * Returns the runtime class of this {@code Object}. The returned
     * {@code Class} object is the object that is locked by {@code
     * static synchronized} methods of the represented class.
     *
     * <p><b>The actual result type is {@code Class<? extends |X|>}
     * where {@code |X|} is the erasure of the static type of the
     * expression on which {@code getClass} is called.</b> For
     * example, no cast is required in this code fragment:</p>
     *
     * <p>
     * {@code Number n = 0;                             }<br>
     * {@code Class<? extends Number> c = n.getClass(); }
     * </p>
     *
     * @return The {@code Class} object that represents the runtime
     *         class of this object.
     * @jls 15.8.2 Class Literals
     */
    public final native Class<?> getClass();
2017年10月8日 00:05
編輯回答
懷中人

首先,我假定你是知道泛型這個概念,如果不知道泛型你可以去看Oracle Java對泛型的描述

這個的參數(shù)是Class類型但是傳遞進來的Class的類型必須是繼承SendDataJob這個類的類型

2017年10月14日 21:57