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


Java SupportedAnnotationTypes類代碼示例

本文整理匯總了Java中javax.annotation.processing.SupportedAnnotationTypes的典型用法代碼示例。如果您正苦於以下問題:Java SupportedAnnotationTypes類的具體用法?Java SupportedAnnotationTypes怎麽用?Java SupportedAnnotationTypes使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: getSupportedAnnotationTypes

import javax.annotation.processing.SupportedAnnotationTypes; //導入依賴的package包/類
/**
 * Always returns a singleton set containing only "*".
 *
 * This method returns the argument to the {@link
 * SupportedAnnotationTypes} annotation, so the effect of returning "*"
 * is as if the checker were annotated by
 * {@code @SupportedAnnotationTypes("*")}:
 * javac runs the checker on every
 * class mentioned on the javac command line.  This method also checks
 * that subclasses do not contain a {@link SupportedAnnotationTypes}
 * annotation.  <p>
 *
 * To specify the annotations that a checker recognizes as type qualifiers,
 * use the {@link TypeQualifiers} annotation on the declaration of
 * subclasses of this class or override the
 * {@link BaseAnnotatedTypeFactory#getSupportedTypeQualifiers()} method.
 *
 * @throws Error if a subclass is annotated with
 *         {@link SupportedAnnotationTypes}
 *
 * @see TypeQualifiers
 */
@Override
public final Set<String> getSupportedAnnotationTypes() {

    SupportedAnnotationTypes supported = this.getClass().getAnnotation(
            SupportedAnnotationTypes.class);
    if (supported != null)
        ErrorReporter.errorAbort("@SupportedAnnotationTypes should not be written on any checker;"
                        + " supported annotation types are inherited from SourceChecker.");
    return Collections.singleton("*");
}
 
開發者ID:reprogrammer,項目名稱:checker-framework,代碼行數:33,代碼來源:SourceChecker.java


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