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


Java ClassName.reflectionName方法代碼示例

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


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

示例1: putType

import com.squareup.javapoet.ClassName; //導入方法依賴的package包/類
/**
 * Adds a {@link TypeSpec} to the set of files that will be generated at the end of the build pipeline.
 * The {@link TypeSpec} will be put into the file under the qualified name {@code pkgName}.
 * Will also add a service entry in each of the service classes listed in {@code providesServicesFor}
 * @param pkgName The fully qualified name of the type to be created.
 * @param newType the new type to be created at the end of the pipeline.
 * @param providesServicesFor A list of classes that the given type provides the service for.
 */
public void putType(String pkgName, TypeSpec newType, List<ClassName> providesServicesFor) {

    // This prevents us from opening the same file twice with the filer
    // as well as letting the user know that the generated two files with the same name
    addToMultiMap(outputClasses, pkgName, newType, "Attempted to generate 2 classes with the same name: ");

    if (!providesServicesFor.isEmpty()) {
        for (ClassName serviceInterface : providesServicesFor) {
            String interfaceQName = serviceInterface.reflectionName();
            // Here it is ok to have dups (but won't happen because of the same call above)
            addToMultiMap(serviceProviders, interfaceQName, pkgName + "." + newType.name, null);
        }
    }
}
 
開發者ID:c0d3d,項目名稱:easy-plugins,代碼行數:23,代碼來源:ProcessorOutputCollection.java


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